http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54249

             Bug #: 54249
           Summary: [C++11] No ::nullptr_t in header <stddef.h>
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: daniel.krueg...@googlemail.com


gcc 4.8.0 20120729 (experimental) rejects the following code:

#include <stddef.h>

::nullptr_t n;

"3|error: 'nullptr_t' in namespace '::' does not name a type"

This code is supposed to be accepted, because [depr.c.headers] p2 says:

"Every C header, each of which has a name of the form name.h, behaves as if
each name placed in the standard library namespace by the corresponding cname
header is placed within the global namespace scope."

Paolo Carlini has suggested to perform this change near to existing C++11-aware
code in stddef.h:

#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \
  || (defined(__cplusplus) && __cplusplus >= 201103L)
#ifndef _GCC_MAX_ALIGN_T
#define _GCC_MAX_ALIGN_T
/* Type whose alignment is supported in every context and is at least
   as great as that of any standard type not using alignment
   specifiers.  */
typedef struct {
  long long __max_align_ll __attribute__((__aligned__(__alignof__(long
long))));
  long double __max_align_ld __attribute__((__aligned__(__alignof__(long
double))));
} max_align_t;
#endif
#endif /* C11 or C++11.  */

[I guess I have selected the wrong component. Please correct, if necessary]

Reply via email to