Message ID | 20161125173137.GL3541@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
On Fri, Nov 25, 2016 at 12:31 PM, Jakub Jelinek <jakub@redhat.com> wrote: > * decl.c (build_enumerator): Call fixup_type_variants on > current_class_type after finish_member_declaration. Let's do this in finish_enum_value_list, in the block controlled by if (at_class_scope_p () && COMPLETE_TYPE_P (current_class_type) && UNSCOPED_ENUM_P (enumtype)) Jason
--- 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 () +{ +}