diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this5.C')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this5.C | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this5.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this5.C new file mode 100644 index 00000000000..8974641643c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this5.C @@ -0,0 +1,22 @@ +// PR c++/53619 +// { dg-do run { target c++11 } } + +struct C { + int x; +}; +struct B { + int q; +}; +struct A : public B , C { + void foo(); +}; + +void A::foo() { + auto k = [this]() {return (void *)(&x);}; + if (k() != (void*)&x) + __builtin_abort(); +} + +int main(int l, char **) { + A a; a.foo(); +} |