gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const2.C
raw| 1 | // PR c++/52026 |
| 2 | // { dg-options "-O" } |
| 3 | // { dg-do run { target c++11 } } |
| 4 | |
| 5 | template<bool B> |
| 6 | int func() { |
| 7 | const int constVal1 = B ? 100 : -100; |
| 8 | const int constVal = constVal1; |
| 9 | return [] { return constVal; }(); |
| 10 | } |
| 11 | |
| 12 | int main() { |
| 13 | if (func<true>() != 100) |
| 14 | __builtin_abort (); |
| 15 | } |