}
void VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
- if (E->getNumArgs() > 0)
- if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E->getArg(0)))
- HandleDeclRefExpr(DRE);
+ Expr *Callee = E->getCallee();
+
+ if (isa<UnresolvedLookupExpr>(Callee))
+ return Inherited::VisitCXXOperatorCallExpr(E);
- Inherited::VisitCXXOperatorCallExpr(E);
+ Visit(Callee);
+ for (auto Arg: E->arguments())
+ HandleValue(Arg->IgnoreParenImpCasts());
}
void VisitUnaryOperator(UnaryOperator *E) {
Inherited::VisitCallExpr(E);
}
+ void VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
+ Expr *Callee = E->getCallee();
+
+ if (isa<UnresolvedLookupExpr>(Callee))
+ return Inherited::VisitCXXOperatorCallExpr(E);
+
+ Visit(Callee);
+ for (auto Arg : E->arguments())
+ HandleValue(Arg->IgnoreParenImpCasts(), false /*AddressOf*/);
+ }
+
void VisitBinaryOperator(BinaryOperator *E) {
// If a field assignment is detected, remove the field from the
// uninitiailized field set.
A(A *a) {}
A(A &&a) {}
~A();
+ bool operator!();
+ bool operator!=(const A&);
};
+bool operator!=(int, const A&);
+
A getA() { return A(); }
A getA(int x) { return A(); }
A getA(A* a) { return A(); }
A a38({a38}); // expected-warning {{variable 'a38' is uninitialized when used within its own initialization}}
A a39 = {a39}; // expected-warning {{variable 'a39' is uninitialized when used within its own initialization}}
A a40 = A({a40}); // expected-warning {{variable 'a40' is uninitialized when used within its own initialization}}
+
+ A a41 = !a41; // expected-warning {{variable 'a41' is uninitialized when used within its own initialization}}
+ A a42 = !(a42); // expected-warning {{variable 'a42' is uninitialized when used within its own initialization}}
+ A a43 = a43 != a42; // expected-warning {{variable 'a43' is uninitialized when used within its own initialization}}
+ A a44 = a43 != a44; // expected-warning {{variable 'a44' is uninitialized when used within its own initialization}}
+ A a45 = a45 != a45; // expected-warning 2{{variable 'a45' is uninitialized when used within its own initialization}}
+ A a46 = 0 != a46; // expected-warning {{variable 'a46' is uninitialized when used within its own initialization}}
}
bool cond;
A a39 = {a39}; // expected-warning {{variable 'a39' is uninitialized when used within its own initialization}}
A a40 = A({a40}); // expected-warning {{variable 'a40' is uninitialized when used within its own initialization}}
+A a41 = !a41; // expected-warning {{variable 'a41' is uninitialized when used within its own initialization}}
+A a42 = !(a42); // expected-warning {{variable 'a42' is uninitialized when used within its own initialization}}
+A a43 = a43 != a42; // expected-warning {{variable 'a43' is uninitialized when used within its own initialization}}
+A a44 = a43 != a44; // expected-warning {{variable 'a44' is uninitialized when used within its own initialization}}
+A a45 = a45 != a45; // expected-warning 2{{variable 'a45' is uninitialized when used within its own initialization}}
+
+A a46 = 0 != a46; // expected-warning {{variable 'a46' is uninitialized when used within its own initialization}}
+
class T {
A a, a2;
const A c_a;
T(bool (*)[38]) : a({a}) {} // expected-warning {{field 'a' is uninitialized when used here}}
T(bool (*)[39]) : a{a} {} // expected-warning {{field 'a' is uninitialized when used here}}
T(bool (*)[40]) : a({a}) {} // expected-warning {{field 'a' is uninitialized when used here}}
+
+ T(bool (*)[41]) : a(!a) {} // expected-warning {{field 'a' is uninitialized when used here}}
+ T(bool (*)[42]) : a(!(a)) {} // expected-warning {{field 'a' is uninitialized when used here}}
+ T(bool (*)[43]) : a(), a2(a2 != a) {} // expected-warning {{field 'a2' is uninitialized when used here}}
+ T(bool (*)[44]) : a(), a2(a != a2) {} // expected-warning {{field 'a2' is uninitialized when used here}}
+ T(bool (*)[45]) : a(a != a) {} // expected-warning 2{{field 'a' is uninitialized when used here}}
+ T(bool (*)[46]) : a(0 != a) {} // expected-warning {{field 'a' is uninitialized when used here}}
};
struct B {