gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this5.C
raw| 1 | // PR c++/53619 |
| 2 | // { dg-do run { target c++11 } } |
| 3 | |
| 4 | struct C { |
| 5 | int x; |
| 6 | }; |
| 7 | struct B { |
| 8 | int q; |
| 9 | }; |
| 10 | struct A : public B , C { |
| 11 | void foo(); |
| 12 | }; |
| 13 | |
| 14 | void A::foo() { |
| 15 | auto k = [this]() {return (void *)(&x);}; |
| 16 | if (k() != (void*)&x) |
| 17 | __builtin_abort(); |
| 18 | } |
| 19 | |
| 20 | int main(int l, char **) { |
| 21 | A a; a.foo(); |
| 22 | } |