blob: dbc63bc4bed827eefd15db3e9737bc6dfed1cac5 [file] [log] [blame]
Jordan Rosee54cfc72012-07-10 22:07:57 +00001// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core,debug.ExprInspection -analyzer-ipa=inlining -verify %s
Jordan Rosefdaa3382012-07-03 22:55:57 +00002void clang_analyzer_eval(bool);
3
Douglas Gregor90d26a42010-11-01 23:16:05 +00004struct X0 { };
5bool operator==(const X0&, const X0&);
6
7// PR7287
8struct test { int a[2]; };
9
10void t2() {
11 test p = {{1,2}};
12 test q;
13 q = p;
14}
15
16bool PR7287(X0 a, X0 b) {
Douglas Gregor73a48ad2010-11-01 23:33:11 +000017 return operator==(a, b);
Douglas Gregor90d26a42010-11-01 23:16:05 +000018}
Jordan Rosefdaa3382012-07-03 22:55:57 +000019
20
21// Inlining non-static member operators mistakenly treated 'this' as the first
22// argument for a while.
23
24struct IntComparable {
25 bool operator==(int x) const {
26 return x == 0;
27 }
28};
29
30void testMemberOperator(IntComparable B) {
Jordan Rosee54cfc72012-07-10 22:07:57 +000031 clang_analyzer_eval(B == 0); // expected-warning{{TRUE}}
Jordan Rosefdaa3382012-07-03 22:55:57 +000032}