2012-05-17 00:01:10 +08:00
|
|
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-ipa=inlining -analyzer-store region -verify %s
|
2011-02-19 09:08:37 +08:00
|
|
|
// XFAIL: *
|
2010-11-01 17:09:44 +08:00
|
|
|
|
2012-05-17 00:01:10 +08:00
|
|
|
void clang_analyzer_eval(bool);
|
|
|
|
|
2010-04-20 13:48:57 +08:00
|
|
|
struct A {
|
|
|
|
int x;
|
|
|
|
A(int a) { x = a; }
|
2010-11-24 21:48:50 +08:00
|
|
|
int getx() const { return x; }
|
2010-04-20 13:48:57 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
void f1() {
|
|
|
|
A x(3);
|
2012-05-17 00:01:10 +08:00
|
|
|
clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
|
2010-04-20 13:48:57 +08:00
|
|
|
}
|
|
|
|
|
2010-11-25 11:18:57 +08:00
|
|
|
void f2() {
|
|
|
|
const A &x = A(3);
|
2012-05-17 00:01:10 +08:00
|
|
|
clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
|
2010-11-25 11:18:57 +08:00
|
|
|
}
|
|
|
|
|
2011-02-19 09:08:37 +08:00
|
|
|
void f3() {
|
|
|
|
const A &x = (A)3;
|
2012-05-17 00:01:10 +08:00
|
|
|
clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
|
2011-02-19 09:08:37 +08:00
|
|
|
}
|