gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi6.C
raw| 1 | // PR c++/58761 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | template <class T> |
| 5 | struct X |
| 6 | { |
| 7 | int x = 42; |
| 8 | int y = [this](){return this->x;}(); |
| 9 | }; |
| 10 | |
| 11 | template <class T> |
| 12 | struct Y |
| 13 | { |
| 14 | int x = 42; |
| 15 | int y = [this](){return this->x;}(); |
| 16 | Y(int) {} |
| 17 | }; |
| 18 | |
| 19 | int main() |
| 20 | { |
| 21 | X<int> x; |
| 22 | Y<int> y(42); |
| 23 | } |