| 1 |
// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,debug.ExprInspection -analyzer-config inline-lambdas=true -verify %s |
| 2 |
|
| 3 |
void clang_analyzer_eval(bool); |
| 4 |
|
| 5 |
void basic() { |
| 6 |
int (*ret_zero)() = []() { return 0; }; |
| 7 |
clang_analyzer_eval(ret_zero() == 0); // expected-warning{{TRUE}} |
| 8 |
} |
| 9 |
|
| 10 |
void withParam() { |
| 11 |
int (*add_ten)(int) = [](int b) { return b + 10; }; |
| 12 |
clang_analyzer_eval(add_ten(1) == 11); // expected-warning{{TRUE}} |
| 13 |
} |
| 14 |
|
| 15 |
int callBack(int (*fp)(int), int x) { |
| 16 |
return fp(x); |
| 17 |
} |
| 18 |
|
| 19 |
void passWithFunc() { |
| 20 |
clang_analyzer_eval(callBack([](int x) { return x; }, 5) == 5); // expected-warning{{TRUE}} |
| 21 |
} |