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

            Bug ID: 114869
           Summary: GCC says nullptr_t is a C built in but it should be in
                    <stddef.h>
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eggert at cs dot ucla.edu
  Target Milestone: ---

This is gcc (GCC) 14.0.1 20240411 (Red Hat 14.0.1-0) on x86-64. Compile the
following one-line program with 'gcc -S t.c':

   nullptr_t x;

GCC fails to issue a diagnostic that is required because nullptr_t is used
without being defined.

Conversely, compile the following program with 'gcc -std=gnu23 -Wshadow
-Wsystem-headers -S t.c':

   #include <stddef.h>
   nullptr_t x;

GCC issues the following incorrect diagnostic:

  In file included from t.c:1:
  /usr/lib/gcc/x86_64-redhat-linux/14/include/stddef.h:450:31: warning:
declaration of ‘nullptr_t’ shadows a global declaration [-Wshadow]
    450 |   typedef __typeof__(nullptr) nullptr_t;
        |                               ^~~~~~~~~
  cc1: note: shadowed declaration is here

It seems that gcc defines nullptr_t as a built in identifier, which is
incorrect; nullptr_t should be defined by <stddef.h> just like ptrdiff_t is.

Reply via email to