aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-07-09 13:56:43 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-07-09 13:56:43 -0400
commitd9fac9dd59fa8f8d646c98d21f6c874f11e608b5 (patch)
tree1550a242e2ba58b3499836790955b38bc436b060 /gcc/testsuite/g++.dg/cpp0x
parentf9f91ddcf76a01b80f8b194f7402aedc40e8af79 (diff)
downloadgcc-d9fac9dd59fa8f8d646c98d21f6c874f11e608b5.zip
gcc-d9fac9dd59fa8f8d646c98d21f6c874f11e608b5.tar.gz
gcc-d9fac9dd59fa8f8d646c98d21f6c874f11e608b5.tar.bz2
re PR c++/57526 (use of X before deduction of auto error for seemingly good code)
PR c++/57526 * semantics.c (lambda_capture_field_type): Build a DECLTYPE_TYPE if the variable type uses 'auto'. From-SVN: r200844
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-auto3.C24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-auto3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-auto3.C
new file mode 100644
index 0000000..013ed52
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-auto3.C
@@ -0,0 +1,24 @@
+// PR c++/57526
+// { dg-require-effective-target c++11 }
+
+template<class T>
+struct A
+{
+ void bar( ) { }
+
+ void foo( )
+ {
+ auto* this_ptr = this;
+ auto lc = [&]( )
+ {
+ this_ptr->bar();
+ };
+ lc();
+ }
+};
+
+int main()
+{
+ A<int> a;
+ a.foo();
+}