re PR c++/84611 (ICE in operator[], at vec.h:826 (local_class_index()))
authorPaolo Carlini <paolo.carlini@oracle.com>
Thu, 19 Apr 2018 18:09:45 +0000 (18:09 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 19 Apr 2018 18:09:45 +0000 (18:09 +0000)
/cp
2018-04-19  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/84611
* pt.c (lookup_template_class_1): Check pushtag return value for
error_mark_node.

/testsuite
2018-04-19  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/84611
* g++.dg/parse/crash68.C: New.

From-SVN: r259505

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/crash68.C [new file with mode: 0644]

index 4475b22..e4c3deb 100644 (file)
@@ -1,3 +1,9 @@
+2018-04-19  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/84611
+       * pt.c (lookup_template_class_1): Check pushtag return value for
+       error_mark_node.
+
 2018-04-19  Alexandre Oliva  <aoliva@redhat.com>
 
        PR c++/80290
index 5d70608..1370e21 100644 (file)
@@ -9444,7 +9444,9 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
 
          /* A local class.  Make sure the decl gets registered properly.  */
          if (context == current_function_decl)
-           pushtag (DECL_NAME (gen_tmpl), t, /*tag_scope=*/ts_current);
+           if (pushtag (DECL_NAME (gen_tmpl), t, /*tag_scope=*/ts_current)
+               == error_mark_node)
+             return error_mark_node;
 
          if (comp_template_args (CLASSTYPE_TI_ARGS (template_type), arglist))
            /* This instantiation is another name for the primary
index e7b9547..bff3cd6 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-19  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/84611
+       * g++.dg/parse/crash68.C: New.
+
 2018-04-19  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR libgcc/85334
diff --git a/gcc/testsuite/g++.dg/parse/crash68.C b/gcc/testsuite/g++.dg/parse/crash68.C
new file mode 100644 (file)
index 0000000..8c1e4ba
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/84611
+
+template<typename = int>
+struct a {
+  a() {
+    struct c;
+    try {
+    } catch (struct c {}) {  // { dg-error "types may not be defined|conflicting" }
+    }
+  }
+};
+
+struct d {
+  d();
+  a<> b;
+};
+
+d::d() {}