[Bug c++/52130] missing check for matching underlying type during instantiation of enum member of class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52130 --- Comment #5 from Jonathan Wakely --- The relevant text in the standard is: "A scoped enumeration shall not be later redeclared as unscoped or with a different underlying type. An unscoped enumeration shall not be later redeclared as scoped and each redeclaration shall include an enum-base specifying the same underlying type as in the original declaration." A suitable diagnostic would be: enumeration type redeclared with different underlying type
[Bug c++/52130] missing check for matching underlying type during instantiation of enum member of class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52130 Eric Gallager changed: What|Removed |Added CC||redi at gcc dot gnu.org --- Comment #4 from Eric Gallager --- What should the correct diagnostic message for it say instead then?
[Bug c++/52130] missing check for matching underlying type during instantiation of enum member of class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52130 --- Comment #3 from Richard Smith --- The diagnostic in #1 is not only wrong for this case, it's also a rejects-valid in the case where the underlying types match. I've filed https://gcc.gnu.org/PR81895 for that.
[Bug c++/52130] missing check for matching underlying type during instantiation of enum member of class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52130 Jonathan Wakely changed: What|Removed |Added Keywords||accepts-invalid Status|WAITING |NEW --- Comment #2 from Jonathan Wakely --- I don't know what an "enumeration template" is, but I would say no. The code should be rejected because S::E is declared with an underlying type of int, then redeclared with an underlying type that depends on the template parameter. The pedwarn about enumeration types is something unrelated, and predates fixed underlying types by more than a decade.
[Bug c++/52130] missing check for matching underlying type during instantiation of enum member of class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52130 Eric Gallager changed: What|Removed |Added Status|UNCONFIRMED |WAITING Last reconfirmed||2017-08-18 CC||egallager at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Eric Gallager --- You can make g++ reject it with -pedantic-errors: $ /usr/local/bin/g++ -c -Wall -Wextra -pedantic-errors -std=c++11 52130.cc 52130.cc:2:27: error: ‘enum S::E’ is an enumeration template [-Wpedantic] template enum S::E : T { e }; ^~~~ $ Is that sufficient?