[libcxx-commits] [PATCH] D137127: [libc++abi] Use std::nullptr_t instead of declaring it manually

Ryan Prichard via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Nov 2 14:52:11 PDT 2022


rprichard updated this revision to Diff 472778.
rprichard added a comment.

Add static_assert


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137127/new/

https://reviews.llvm.org/D137127

Files:
  libcxxabi/test/catch_reference_nullptr.pass.cpp


Index: libcxxabi/test/catch_reference_nullptr.pass.cpp
===================================================================
--- libcxxabi/test/catch_reference_nullptr.pass.cpp
+++ libcxxabi/test/catch_reference_nullptr.pass.cpp
@@ -6,11 +6,13 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: c++03,
+// UNSUPPORTED: c++03
 // UNSUPPORTED: no-exceptions
 
 #include <cassert>
+#include <cstddef>
 #include <cstdlib>
+#include <type_traits>
 
 struct A {};
 
@@ -27,13 +29,13 @@
 
 int main(int, char**)
 {
-  using nullptr_t = decltype(nullptr);
+  static_assert(std::is_same_v<std::nullptr_t, decltype(nullptr)>, "");
 
   // A reference to nullptr_t can catch nullptr.
-  catch_nullptr_test<nullptr_t, true>();
-  catch_nullptr_test<const nullptr_t, true>();
-  catch_nullptr_test<volatile nullptr_t, true>();
-  catch_nullptr_test<const volatile nullptr_t, true>();
+  catch_nullptr_test<std::nullptr_t, true>();
+  catch_nullptr_test<const std::nullptr_t, true>();
+  catch_nullptr_test<volatile std::nullptr_t, true>();
+  catch_nullptr_test<const volatile std::nullptr_t, true>();
 
   // No other reference type can.
 #if 0


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137127.472778.patch
Type: text/x-patch
Size: 1188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221102/e1d7f66e/attachment.bin>


More information about the libcxx-commits mailing list