public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/114869] New: GCC says nullptr_t is a C built in but it should be in <stddef.h>
@ 2024-04-26 20:14 eggert at cs dot ucla.edu
  2024-04-29 21:22 ` [Bug c/114869] " jsm28 at gcc dot gnu.org
  2024-04-29 21:25 ` mpolacek at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: eggert at cs dot ucla.edu @ 2024-04-26 20:14 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/114869] GCC says nullptr_t is a C built in but it should be in <stddef.h>
  2024-04-26 20:14 [Bug c/114869] New: GCC says nullptr_t is a C built in but it should be in <stddef.h> eggert at cs dot ucla.edu
@ 2024-04-29 21:22 ` jsm28 at gcc dot gnu.org
  2024-04-29 21:25 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2024-04-29 21:22 UTC (permalink / raw)
  To: gcc-bugs

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

Joseph S. Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-04-29
                 CC|                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
I suspect

  /* C-specific nullptr initialization.  */
  record_builtin_type (RID_MAX, "nullptr_t", nullptr_type_node);

in c-decl.cc, from the original nullptr support for C.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/114869] GCC says nullptr_t is a C built in but it should be in <stddef.h>
  2024-04-26 20:14 [Bug c/114869] New: GCC says nullptr_t is a C built in but it should be in <stddef.h> eggert at cs dot ucla.edu
  2024-04-29 21:22 ` [Bug c/114869] " jsm28 at gcc dot gnu.org
@ 2024-04-29 21:25 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-04-29 21:25 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-29 21:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-26 20:14 [Bug c/114869] New: GCC says nullptr_t is a C built in but it should be in <stddef.h> eggert at cs dot ucla.edu
2024-04-29 21:22 ` [Bug c/114869] " jsm28 at gcc dot gnu.org
2024-04-29 21:25 ` mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).