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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |SUSPENDED
            Summary|nullptr_t available without |[DR 3484] nullptr_t
                   |namespace qualification     |available without namespace
                   |                            |qualification

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #1)
> For some reason, GCC's
> <stddef.h> defines nullptr_t in the global namespace (and libstdc++
> <cstddef> in std).

Because that's exactly what the standard requires.

[depr.c.headers.other] says:

Every C header [...] behaves as if each name placed in the standard library
namespace by the corresponding <cname> header is placed within the global
namespace scope, except for the functions described in 26.8.6,
the declaration of std::byte (17.2.1), and the functions and function templates
described in 17.2.5.

Only the <cmath> special functions and std::byte are excluded. std::nullptr_t
is required to be redeclared in the global namespace.

There is an open LWG issue suggesting to remove nullptr_t from <stddef.h>:
https://cplusplus.github.io/LWG/issue3484

Until that is resolved (or we at least have consensus to remove it) I'm
suspending this PR.


(In reply to Andrew Pinski from comment #2)
> It looks like it is still needed but I think could pull that into
> libstdc++/include/c_compatibility/stddef.h instead.

No, because that header is not installed in the usual configurations. The
default configuration only installs these wrappers for the C headers:

if GLIBCXX_C_HEADERS_C_GLOBAL
c_compatibility_headers = \
        ${c_compatibility_srcdir}/complex.h \
        ${c_compatibility_srcdir}/fenv.h \
        ${c_compatibility_srcdir}/tgmath.h \
        ${c_compatibility_srcdir}/math.h \
        ${c_compatibility_srcdir}/stdlib.h
endif

Reply via email to