[Bug c++/94510] [9/10 Regression] nullptr_t implicitly cast to zero twice in std::array
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Apr 7 18:51:43 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94510
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
--- Comment #10 from Martin Sebor <msebor at gcc dot gnu.org> ---
POINTER_TYPE_P() is zero because while nullptr is specified to be "the pointer
literal is the keyword nullptr" it also "...is a prvalue of type
std::nullptr_t. [Note: std::nullptr_t is a distinct type that is neither a
pointer type nor a pointer-to-member type; ..." Of course -- a pointer literal
that doesn't have a pointer type, makes perfect sense.
Another closely related regression r270155 introduced is the missing warning
for the following test case:
$ cat t.C && gcc-8 -S -Wall t.C
#include <stddef.h>
int a[2] = { NULL };
t.C:3:19: warning: converting to non-pointer type ‘int’ from NULL
[-Wconversion-null]
int a[2] = { NULL };
^
The patch at the link below restores both diagnostics:
https://gcc.gnu.org/pipermail/gcc-patches/2020-April/543482.html
More information about the Gcc-bugs
mailing list