gcc/testsuite/g++.dg/warn/Wint-in-bool-context-2.C
raw| 1 | // { dg-do compile { target c++11 } } |
| 2 | // { dg-options "-Wint-in-bool-context" } |
| 3 | |
| 4 | unsigned hb(unsigned i) { return ~i; } |
| 5 | |
| 6 | template<typename T> |
| 7 | void f(int i) |
| 8 | { |
| 9 | auto l = [i]() { return T(2 * hb(i)); }; // { dg-bogus "in boolean context" } |
| 10 | (void) l; |
| 11 | } |
| 12 | |
| 13 | int main() |
| 14 | { |
| 15 | f<bool>(0); |
| 16 | } |