PR c++/82069 - ICE with lambda in template
authorJason Merrill <jason@redhat.com>
Mon, 18 Sep 2017 17:41:07 +0000 (13:41 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 18 Sep 2017 17:41:07 +0000 (13:41 -0400)
* semantics.c (process_outer_var_ref): Check uses_template_parms
instead of any_dependent_template_arguments_p.

From-SVN: r252936

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template15.C [new file with mode: 0644]

index b43f042673631bfecc828ec5378b77309363f656..01a03f9161ad958f19d49523d7d5183cf2ce0a9e 100644 (file)
@@ -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>
 
index 4f4c17f853d5f5c86eaebd86a34f24a332e923f7..3a3ae55aa4417776439fc83a076b8615619eb681 100644 (file)
@@ -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 (file)
index 0000000..4da64f2
--- /dev/null
@@ -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); };
+  }
+};