re PR c++/86546 (ICE on invalid: tree_class_check_failed())
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 28 Aug 2018 15:01:15 +0000 (15:01 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 28 Aug 2018 15:01:15 +0000 (15:01 +0000)
/cp
2018-08-28  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/86546
* decl.c (finish_case_label): If the type is erroneous early
return error_mark_node.

/testsuite
2018-08-28  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/86546
* g++.dg/other/switch4.C: New.

From-SVN: r263921

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/switch4.C [new file with mode: 0644]

index 7efc8d47d9bfb98dd88c23de0a026c78bbc2c574..087beb679fb065d37a785ff988935ad44ab272e6 100644 (file)
@@ -1,3 +1,9 @@
+2018-08-28  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/86546
+       * decl.c (finish_case_label): If the type is erroneous early
+       return error_mark_node.
+
 2018-08-27  David Malcolm  <dmalcolm@redhat.com>
 
        PR c++/63392
index d9f4d3489292c0f14cb9ef4effc8a9345cfa2f23..7fee3da1f4909238f854db27fd50898013e90d1c 100644 (file)
@@ -3662,6 +3662,8 @@ finish_case_label (location_t loc, tree low_value, tree high_value)
     return error_mark_node;
 
   type = SWITCH_STMT_TYPE (switch_stack->switch_stmt);
+  if (type == error_mark_node)
+    return error_mark_node;
 
   low_value = case_conversion (type, low_value);
   high_value = case_conversion (type, high_value);
index c00761123a6cc939cbfc79befe38dc295cd24925..59fedafab537838de5f57249f6049f61327e9b92 100644 (file)
@@ -1,3 +1,8 @@
+2018-08-28  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/86546
+       * g++.dg/other/switch4.C: New.
+
 2018-08-28  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/87124
diff --git a/gcc/testsuite/g++.dg/other/switch4.C b/gcc/testsuite/g++.dg/other/switch4.C
new file mode 100644 (file)
index 0000000..42acb1b
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/86546
+
+class a b;  // { dg-error "aggregate" }
+void c() {
+  switch ()  // { dg-error "expected" }
+  case b  // { dg-error "expected" }