aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-09-18 13:41:07 -0400
committerJason Merrill <jason@gcc.gnu.org>2017-09-18 13:41:07 -0400
commit04dcd57085271abc8c603c72f4d10472056996ea (patch)
tree232df7072703fc42b4cf4870b5451895cc56e4aa
parent8b7e9dba2bc921c24994129bb9231caa176d6da5 (diff)
downloadgcc-04dcd57085271abc8c603c72f4d10472056996ea.zip
gcc-04dcd57085271abc8c603c72f4d10472056996ea.tar.gz
gcc-04dcd57085271abc8c603c72f4d10472056996ea.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/semantics.c3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template15.C11
3 files changed, 18 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b43f042..01a03f9 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2017-09-18 Jason Merrill <jason@redhat.com>
+
+ 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 <manu@gcc.gnu.org>
Paolo Carlini <paolo.carlini@oracle.com>
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 4f4c17f..3a3ae55 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 0000000..4da64f2
--- /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 <typename> void bar(int *p1) {
+ [&] { foo(p1); };
+ }
+};