[llvm-branch-commits] [clang] d72ad36 - Revert "[C++] Expose nullptr_t from stddef.h in C++ mode (#154599)"

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Aug 21 07:01:27 PDT 2025


Author: Aaron Ballman
Date: 2025-08-21T10:01:23-04:00
New Revision: d72ad36f407f28cf8b3f23f3a8bdb835eb7b8776

URL: https://github.com/llvm/llvm-project/commit/d72ad36f407f28cf8b3f23f3a8bdb835eb7b8776
DIFF: https://github.com/llvm/llvm-project/commit/d72ad36f407f28cf8b3f23f3a8bdb835eb7b8776.diff

LOG: Revert "[C++] Expose nullptr_t from stddef.h in C++ mode (#154599)"

This reverts commit 7d167f45643b37a627e2aef49f718a5a2debd5d3.

Added: 
    

Modified: 
    clang/docs/ReleaseNotes.rst
    clang/lib/Headers/__stddef_nullptr_t.h
    clang/test/Headers/stddefneeds.cpp

Removed: 
    


################################################################################
diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index c32102d102cd3..fe1dd15c6f885 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -229,7 +229,6 @@ Bug Fixes in This Version
   cast chain. (#GH149967).
 - Fixed a crash with incompatible pointer to integer conversions in designated
   initializers involving string literals. (#GH154046)
-- Clang's ``<stddef.h>`` now properly declares ``nullptr_t`` in C++ mode. (#GH154577).
 
 Bug Fixes to Compiler Builtins
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

diff  --git a/clang/lib/Headers/__stddef_nullptr_t.h b/clang/lib/Headers/__stddef_nullptr_t.h
index c84b7bc2dc198..7f3fbe6fe0d3a 100644
--- a/clang/lib/Headers/__stddef_nullptr_t.h
+++ b/clang/lib/Headers/__stddef_nullptr_t.h
@@ -16,8 +16,7 @@
 #define _NULLPTR_T
 
 #ifdef __cplusplus
-#if __cplusplus >= 201103L ||                                                  \
-    (defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED))
+#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED)
 namespace std {
 typedef decltype(nullptr) nullptr_t;
 }

diff  --git a/clang/test/Headers/stddefneeds.cpp b/clang/test/Headers/stddefneeds.cpp
index 6e8829bc1be67..0282e8afa600d 100644
--- a/clang/test/Headers/stddefneeds.cpp
+++ b/clang/test/Headers/stddefneeds.cpp
@@ -1,12 +1,10 @@
 // RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.9.0 -verify -Wsentinel -std=c++11 %s
-// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.9.0 -verify=old,expected -Wsentinel -std=c++98 %s
 
 ptr
diff _t p0; // expected-error{{unknown}}
 size_t s0; // expected-error{{unknown}}
 void* v0 = NULL; // expected-error{{undeclared}}
 wint_t w0; // expected-error{{unknown}}
 max_align_t m0; // expected-error{{unknown}}
-nullptr_t n0; // expected-error {{unknown}}
 
 #define __need_ptr
diff _t
 #include <stddef.h>
@@ -16,7 +14,6 @@ size_t s1; // expected-error{{unknown}}
 void* v1 = NULL; // expected-error{{undeclared}}
 wint_t w1; // expected-error{{unknown}}
 max_align_t m1; // expected-error{{unknown}}
-nullptr_t n1; // expected-error{{unknown}}
 
 #define __need_size_t
 #include <stddef.h>
@@ -26,16 +23,6 @@ size_t s2;
 void* v2 = NULL; // expected-error{{undeclared}}
 wint_t w2; // expected-error{{unknown}}
 max_align_t m2; // expected-error{{unknown}}
-nullptr_t n2; // expected-error{{unknown}}
-
-#define __need_nullptr_t
-#include <stddef.h>
-ptr
diff _t p6;
-size_t s6;
-void* v6 = NULL; // expected-error{{undeclared}}
-wint_t w6; // expected-error{{unknown}}
-max_align_t m6; // expected-error{{unknown}}
-nullptr_t n6; // old-error{{unknown}}
 
 #define __need_NULL
 #include <stddef.h>
@@ -45,16 +32,6 @@ size_t s3;
 void* v3 = NULL;
 wint_t w3; // expected-error{{unknown}}
 max_align_t m3; // expected-error{{unknown}}
-nullptr_t n3; // old-error{{unknown}}
-
-#define __need_max_align_t
-#include <stddef.h>
-ptr
diff _t p7;
-size_t s7;
-void* v7 = NULL;
-wint_t w7; // expected-error{{unknown}}
-max_align_t m7;
-nullptr_t n7; // old-error{{unknown}}
 
 // Shouldn't bring in wint_t by default:
 #include <stddef.h>
@@ -64,7 +41,6 @@ size_t s4;
 void* v4 = NULL;
 wint_t w4; // expected-error{{unknown}}
 max_align_t m4;
-nullptr_t n4; // old-error{{unknown}}
 
 #define __need_wint_t
 #include <stddef.h>
@@ -74,7 +50,7 @@ size_t s5;
 void* v5 = NULL;
 wint_t w5;
 max_align_t m5;
-nullptr_t n5; // old-error{{unknown}}
+
 
 // linux/stddef.h does something like this for cpp files:
 #undef NULL


        


More information about the llvm-branch-commits mailing list