https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102804
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |NEW Summary|template matching fails w/ |[9/10/11/12 Regression] |false ambiguity on ternary |template matching fails w/ |expressions with enums |false ambiguity on ternary |class defined with unsigned |expressions with enums |typdef |class defined with unsigned | |typedef CC| |mukesh.kapoor at oracle dot com Resolution|INVALID |--- Known to work| |7.4.0 Last reconfirmed| |2021-10-18 Ever confirmed|0 |1 Keywords| |rejects-valid Known to fail| |8.1.0 --- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- This is a bug, we should either reject 'unsigned int32_t' immediately (which we only do with -pedantic-errors) or we should accept it and treat it consistently as unsigned int. Reduced: enum: unsigned int32_t { FOO, BAR } foobar = FOO; int f(int); int f(unsigned); auto x = f(1 ? foobar : 13); With r254043 we just have a pedwarn: 102804.C:2:16: warning: long, short, signed or unsigned used invalidly for 'type name' [-Wpedantic] enum: unsigned int32_t { FOO, BAR } foobar = FOO; ^~~~~~~ With r254046 we get the error: 102804.C:2:16: warning: long, short, signed or unsigned used invalidly for 'type name' [-Wpedantic] enum: unsigned int32_t { FOO, BAR } foobar = FOO; ^~~~~~~ 102804.C:5:27: error: call of overloaded 'f(unsigned int)' is ambiguous auto x = f(1 ? foobar : 13); ^ 102804.C:3:5: note: candidate: 'int f(int)' int f(int); ^ 102804.C:4:5: note: candidate: 'int f(unsigned int)' int f(unsigned); ^ re PR c++/82307 (unscoped enum-base incorrect cast) /cp 2017-10-24 Mukesh Kapoor <mukesh.kap...@oracle.com> Paolo Carlini <paolo.carl...@oracle.com> PR c++/82307 * cvt.c (type_promotes_to): Implement C++17, 7.6/4, about unscoped enumeration type whose underlying type is fixed. So it was actually caused by fixing the promotion rules for enums (PR 82307), not by the handling of 'unsigned' applied to a typedef.