https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84701
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |jason at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Using typeof(var) in casts of course works, but that is not what you are doing, you are using that plus unsigned. This is rejected by other compilers or with -pedantic-errors by G++: error: long, short, signed or unsigned used invalidly for ‘type name’ Otherwise it is an extension which handles the typedef cases by: if (explicit_intN) type = int_n_trees[declspecs->int_n_idx].unsigned_type; else if (longlong) type = long_long_unsigned_type_node; else if (long_p) type = long_unsigned_type_node; else if (short_p) type = short_unsigned_type_node; else if (type == char_type_node) type = unsigned_char_type_node; else if (typedef_decl) type = unsigned_type_for (type); else type = unsigned_type_node; (that is the typedef_decl case) but typeof doesn't fall into that category and so it is just always set to unsigned. Not really convinced we should extend this extension for typeof, perhaps better just to reject it even when not pedantic if it is the unsigned/signed/long/short etc. typeof () case.