Hi! As mentioned in the PR, we ICE during type verification called from dwarf2out, because a class has different TYPE_FIELDS from its variants. In particular it contains an extra CONST_DECL. While CONST_DECLs are ignored for C/C++ in dwarf2out.c, I think they aren't ignored for Fortran/Ada, so ignoring them in the verifier might be too risky.
This patch instead fixes the variants immediately. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? Another possibility would be just to update TYPE_FIELDS of the variants instead of calling whole fixup_type_variants. 2016-11-25 Jakub Jelinek <ja...@redhat.com> PR c++/72808 * decl.c (build_enumerator): Call fixup_type_variants on current_class_type after finish_member_declaration. * g++.dg/debug/pr72808.C: New test. --- gcc/cp/decl.c.jj 2016-11-23 19:44:40.000000000 +0100 +++ gcc/cp/decl.c 2016-11-25 13:15:46.407116179 +0100 @@ -14518,6 +14518,7 @@ incremented enumerator value is too larg current_access_specifier = access_public_node; finish_member_declaration (decl); + fixup_type_variants (current_class_type); current_access_specifier = saved_cas; } --- gcc/testsuite/g++.dg/debug/pr72808.C.jj 2016-11-25 13:17:06.777091600 +0100 +++ gcc/testsuite/g++.dg/debug/pr72808.C 2016-11-25 13:16:27.000000000 +0100 @@ -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 () +{ +} Jakub