2012-07-11 06:07:57 +08:00
|
|
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core,debug.ExprInspection -analyzer-ipa=inlining -verify %s
|
2012-07-04 06:55:57 +08:00
|
|
|
void clang_analyzer_eval(bool);
|
|
|
|
|
2010-11-02 07:16:05 +08:00
|
|
|
struct X0 { };
|
|
|
|
bool operator==(const X0&, const X0&);
|
|
|
|
|
|
|
|
// PR7287
|
|
|
|
struct test { int a[2]; };
|
|
|
|
|
|
|
|
void t2() {
|
|
|
|
test p = {{1,2}};
|
|
|
|
test q;
|
|
|
|
q = p;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool PR7287(X0 a, X0 b) {
|
2010-11-02 07:33:11 +08:00
|
|
|
return operator==(a, b);
|
2010-11-02 07:16:05 +08:00
|
|
|
}
|
2012-07-04 06:55:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
// Inlining non-static member operators mistakenly treated 'this' as the first
|
|
|
|
// argument for a while.
|
|
|
|
|
|
|
|
struct IntComparable {
|
|
|
|
bool operator==(int x) const {
|
|
|
|
return x == 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
void testMemberOperator(IntComparable B) {
|
2012-07-11 06:07:57 +08:00
|
|
|
clang_analyzer_eval(B == 0); // expected-warning{{TRUE}}
|
2012-07-04 06:55:57 +08:00
|
|
|
}
|