gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C
raw| 1 | // PR c++/47795 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | class Klass |
| 5 | { |
| 6 | unsigned int local; |
| 7 | public: |
| 8 | bool dostuff(); |
| 9 | }; |
| 10 | |
| 11 | bool Klass::dostuff() |
| 12 | { |
| 13 | auto f = []() -> bool { |
| 14 | if (local & 1) { return true; } // { dg-error "not captured|non-static" } |
| 15 | return false; |
| 16 | }; |
| 17 | |
| 18 | return true; |
| 19 | } |
| 20 | |
| 21 | int main() |
| 22 | { |
| 23 | Klass c; |
| 24 | return 0; |
| 25 | } |