From 04dcd57085271abc8c603c72f4d10472056996ea Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 18 Sep 2017 13:41:07 -0400 Subject: [PATCH] PR c++/82069 - ICE with lambda in template * semantics.c (process_outer_var_ref): Check uses_template_parms instead of any_dependent_template_arguments_p. From-SVN: r252936 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/semantics.c | 3 +-- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template15.C | 11 +++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template15.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b43f0426736..01a03f9161a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-09-18 Jason Merrill + + PR c++/82069 - ICE with lambda in template + * semantics.c (process_outer_var_ref): Check uses_template_parms + instead of any_dependent_template_arguments_p. + 2017-09-15 Manuel Lopez-Ibanez Paolo Carlini diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 4f4c17f853d..3a3ae55aa44 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -3347,8 +3347,7 @@ process_outer_var_ref (tree decl, tsubst_flags_t complain) time to implicitly capture. */ if (context == containing_function && DECL_TEMPLATE_INFO (containing_function) - && any_dependent_template_arguments_p (DECL_TI_ARGS - (containing_function))) + && uses_template_parms (DECL_TI_ARGS (containing_function))) return decl; /* Core issue 696: "[At the July 2009 meeting] the CWG expressed diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template15.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template15.C new file mode 100644 index 00000000000..4da64f27fd8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template15.C @@ -0,0 +1,11 @@ +// PR c++/82069 +// { dg-do compile { target c++11 } } + +struct A { + void foo(int *); +}; +struct B : A { + template void bar(int *p1) { + [&] { foo(p1); }; + } +}; -- 2.30.2