[Bug c++/78014] -Wformat -vs- size_t

de34 at live dot cn gcc-bugzilla@gcc.gnu.org
Wed Oct 19 03:29:43 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78014

Jiang An <de34 at live dot cn> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |de34 at live dot cn

--- Comment #9 from Jiang An <de34 at live dot cn> ---
Additionally, what happens when I write `using my_size_t =
decltype(sizeof(0));` (C++) or `typedef typeof(sizeof(0)) my_size_t;` (GNU C or
C23)?

I think such enhancement of warnings effectively requires size_t to be some
kind of "strong typedef", and the "strength" should be generated from sizeof,
alignof, etc..

Perhaps the built-in operator- between pointers also needs to generate such
"strength" for the purpose of ptrdiff_t.


More information about the Gcc-bugs mailing list