| 1 |
// RUN: %clang_analyze_cc1 -verify %s\ |
| 2 |
// RUN: -analyzer-checker=core,debug.ExprInspection |
| 3 |
|
| 4 |
void clang_analyzer_eval(bool); |
| 5 |
|
| 6 |
using size_t = decltype(sizeof(int)); |
| 7 |
|
| 8 |
template <class FirstT, class... Rest> |
| 9 |
void escape(FirstT first, Rest... args); |
| 10 |
|
| 11 |
namespace CustomClassType { |
| 12 |
struct S { |
| 13 |
int x; |
| 14 |
static void* operator new(size_t size) { |
| 15 |
return ::operator new(size); |
| 16 |
} |
| 17 |
}; |
| 18 |
void F() { |
| 19 |
S *s = new S; |
| 20 |
clang_analyzer_eval(s->x); // expected-warning{{UNKNOWN}} FIXME: should be an undefined warning |
| 21 |
|
| 22 |
S *s2 = new S{}; |
| 23 |
clang_analyzer_eval(0 == s2->x); // expected-warning{{TRUE}} |
| 24 |
|
| 25 |
S *s3 = new S{1}; |
| 26 |
clang_analyzer_eval(1 == s3->x); // expected-warning{{TRUE}} |
| 27 |
|
| 28 |
escape(s, s2, s3); |
| 29 |
} |
| 30 |
} // namespace CustomClassType |