From: Jakub Jelinek Date: Mon, 28 Nov 2016 19:20:02 +0000 (+0100) Subject: re PR c++/72808 (ICE on valid c++ code in verify_type (gcc/tree.c:14047)) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f28fd43ea80711f0735903a09f67ceb7278a7c58;p=gcc.git re PR c++/72808 (ICE on valid c++ code in verify_type (gcc/tree.c:14047)) PR c++/72808 * decl.c (finish_enum_value_list): Call fixup_type_variants on current_class_type after insert_late_enum_def_into_classtype_sorted_fields. * g++.dg/debug/pr72808.C: New test. Co-Authored-By: Jason Merrill From-SVN: r242930 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f442a7a83f0..476ff654bce 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2016-11-28 Jakub Jelinek + Jason Merrill + + PR c++/72808 + * decl.c (finish_enum_value_list): Call fixup_type_variants on + current_class_type after + insert_late_enum_def_into_classtype_sorted_fields. + 2016-11-28 Jakub Jelinek PR c++/77591 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 6893eae084a..f0850d726ed 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -14280,8 +14280,11 @@ finish_enum_value_list (tree enumtype) if (at_class_scope_p () && COMPLETE_TYPE_P (current_class_type) && UNSCOPED_ENUM_P (enumtype)) - insert_late_enum_def_into_classtype_sorted_fields (enumtype, - current_class_type); + { + insert_late_enum_def_into_classtype_sorted_fields (enumtype, + current_class_type); + fixup_type_variants (current_class_type); + } /* Finish debugging output for this type. */ rest_of_type_compilation (enumtype, namespace_bindings_p ()); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 04a6840299d..0579927fa13 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-11-28 Jakub Jelinek + PR c++/72808 + * g++.dg/debug/pr72808.C: New test. + PR rtl-optimization/78546 * gcc.dg/torture/pr78546-1.c: New test. * gcc.dg/torture/pr78546-2.c: New test. diff --git a/gcc/testsuite/g++.dg/debug/pr72808.C b/gcc/testsuite/g++.dg/debug/pr72808.C new file mode 100644 index 00000000000..7e4688c3e70 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/pr72808.C @@ -0,0 +1,24 @@ +// PR c++/72808 +// { dg-do compile } +// { dg-options "-g -std=c++14" } + +struct A +{ + virtual void foo (); +}; + +struct B : A +{ + void foo (); + enum C : int; +}; + +enum B::C : int +{ + D +}; + +void +B::foo () +{ +}