diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mutable2.C')
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mutable2.C | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mutable2.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mutable2.C new file mode 100644 index 0000000..c54ff5c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mutable2.C @@ -0,0 +1,23 @@ +// PR c++/55532 +// { dg-do compile { target c++11 } } + +struct Foo { + void doit() { + } +}; + +template<typename T> +void oops(Foo &foo, const T &) { + auto fun = [&] () mutable { + foo.doit(); + }; + auto fun2 = [=]() { + fun(); // { dg-error "" } + }; + fun2(); +} + +int main() { + Foo foo; + oops(foo, 1); +} |