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 4475b228c2eb1dd7083f95c99997630540f36cb0..e4c3deb26fbf708e19aa0ef5341a123adea09f19 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 5d7060858b952ae785716e9c681a7f297f57c25b..1370e21ad5957418bde608b91eb6bd5cb0b13ff8 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 e7b9547c1a41502eff9a4f1dcf72dbdeb182a85c..bff3cd6e9957dced199a016353b40fb6f1879840 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() {}