diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2018-08-28 15:01:15 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2018-08-28 15:01:15 +0000 |
commit | f30bafb7fcf78e1472cb6cadc6e953d1586a0db3 (patch) | |
tree | 8b1a3e3a82da9257fd4bc464e7c94f37e5a34c24 | |
parent | 1978408086a9df584d2cdb3f36e6639de5a28459 (diff) | |
download | gcc-f30bafb7fcf78e1472cb6cadc6e953d1586a0db3.zip gcc-f30bafb7fcf78e1472cb6cadc6e953d1586a0db3.tar.gz gcc-f30bafb7fcf78e1472cb6cadc6e953d1586a0db3.tar.bz2 |
re PR c++/86546 (ICE on invalid: tree_class_check_failed())
/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
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/switch4.C | 6 |
4 files changed, 19 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7efc8d4..087beb6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index d9f4d34..7fee3da 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c007611..59fedaf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 0000000..42acb1b --- /dev/null +++ b/gcc/testsuite/g++.dg/other/switch4.C @@ -0,0 +1,6 @@ +// PR c++/86546 + +class a b; // { dg-error "aggregate" } +void c() { + switch () // { dg-error "expected" } + case b // { dg-error "expected" } |