Hi,

this patchlet fixes the issue reported by Daniel by simply adding nullptr_t to the global namespace in stddef.h (over which luckily we have control). Tested x86_64-linux.

Thanks,
Paolo.

/////////////////////
2012-09-28  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/54249
        * ginclude/stddef.h: In C++11 mode declare nullptr_t in the global
        namespace.

/testsuite
2012-09-28  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/54249
        * g++.dg/cpp0x/stddef.C: New.
Index: ginclude/stddef.h
===================================================================
--- ginclude/stddef.h   (revision 191823)
+++ ginclude/stddef.h   (working copy)
@@ -427,6 +427,13 @@ typedef struct {
 #endif
 #endif /* C11 or C++11.  */
 
+#if defined(__cplusplus) && __cplusplus >= 201103L
+#ifndef _GXX_NULLPTR_T
+#define _GXX_NULLPTR_T
+  typedef decltype(nullptr) nullptr_t;
+#endif
+#endif /* C++11.  */
+
 #endif /* _STDDEF_H was defined this time */
 
 #endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
Index: testsuite/g++.dg/cpp0x/stddef.C
===================================================================
--- testsuite/g++.dg/cpp0x/stddef.C     (revision 0)
+++ testsuite/g++.dg/cpp0x/stddef.C     (working copy)
@@ -0,0 +1,6 @@
+// PR c++/54249
+// { dg-do compile { target c++11 } }
+
+#include <stddef.h>
+
+::nullptr_t n;

Reply via email to