https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84701
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-03-29
CC| |msebor at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
It's diagnosed with -Wpedantic (ditto for decltype). Agreed that it should be
rejected in C++ just like it is in C.
$ cat pr84701.C && gcc -S -Wall -Wextra -Wpedantic pr84701.C
typedef short foo_t;
foo_t s = -1; /* FFFF */
unsigned u = (unsigned foo_t)s; /* result is FFFF */
unsigned v = (unsigned typeof(s))s; /* result is FFFFFFFF */
pr84701.C:4:24: warning: long, short, signed or unsigned used invalidly for
‘type name’ [-Wpedantic]
unsigned u = (unsigned foo_t)s; /* result is FFFF */
^~~~~
pr84701.C:5:32: warning: long, short, signed or unsigned used invalidly for
‘type name’ [-Wpedantic]
unsigned v = (unsigned typeof(s))s; /* result is FFFFFFFF */
^