mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-22 10:35:22 +08:00
c++: unsigned int32_t enum promotion [PR102804]
There's been an extension for a long time to allow applying 'unsigned' to an int typedef, but that was confusing the integer promotion code. Fixed by forgetting about the typedef in that case. I'm going to make this an unconditional pedwarn in stage 1. PR c++/102804 gcc/cp/ChangeLog: * decl.cc (grokdeclarator): Drop typedef used with 'unsigned'. gcc/testsuite/ChangeLog: * g++.dg/ext/unsigned-typedef1.C: New test.
This commit is contained in:
parent
6364a39907
commit
e580f81d22
@ -12243,6 +12243,8 @@ grokdeclarator (const cp_declarator *declarator,
|
||||
pedwarn (loc, OPT_Wpedantic, "%qs specified with %qT",
|
||||
key, type);
|
||||
ok = !flag_pedantic_errors;
|
||||
type = DECL_ORIGINAL_TYPE (typedef_decl);
|
||||
typedef_decl = NULL_TREE;
|
||||
}
|
||||
else if (declspecs->decltype_p)
|
||||
error_at (loc, "%qs specified with %<decltype%>", key);
|
||||
|
9
gcc/testsuite/g++.dg/ext/unsigned-typedef1.C
Normal file
9
gcc/testsuite/g++.dg/ext/unsigned-typedef1.C
Normal file
@ -0,0 +1,9 @@
|
||||
// PR c++/102804
|
||||
// { dg-do compile { target c++11 } }
|
||||
// { dg-options "-Wpedantic" }
|
||||
|
||||
using int32_t = int;
|
||||
enum: unsigned int32_t { foo }; // { dg-warning "int32_t" }
|
||||
int f(int) = delete;
|
||||
int f(unsigned);
|
||||
auto x = f(1 ? foo : 1);
|
Loading…
Reference in New Issue
Block a user