From 637e43b8e1b2d18f51f6d18714cb794717ced3c4 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Thu, 5 Mar 2015 08:48:22 +0000 Subject: [PATCH] re PR c++/64834 (Captured variable not available in unevaluated context in a lambda with auto argument) 2015-03-05 Paolo Carlini PR c++/64834 * g++.dg/cpp1y/lambda-generic-uneval1.C: New. From-SVN: r221205 --- gcc/testsuite/ChangeLog | 5 +++++ .../g++.dg/cpp1y/lambda-generic-uneval1.C | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/lambda-generic-uneval1.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a16501a222d..937afa58a36 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-03-05 Paolo Carlini + + PR c++/64834 + * g++.dg/cpp1y/lambda-generic-uneval1.C: New. + 2015-03-04 Eric Botcazou * gnat.dg/entry_queues3.adb: New test. diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-uneval1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-uneval1.C new file mode 100644 index 00000000000..113eacf843c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-uneval1.C @@ -0,0 +1,17 @@ +// PR c++/64834 +// { dg-do compile { target c++14 } } + +template +void e(F f) +{ + f(1); +} + +template +void bar() { + int x; + e([&] (const int& y) { (void)sizeof(x); }); + e([&] (const auto& y) { (void)sizeof(x); }); +} + +void baz() { bar<1>(); } -- 2.30.2