[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
Mon Oct 31 15:44:54 PDT 2022
rprichard created this revision.
rprichard added reviewers: ldionne, danalbert.
Herald added a project: All.
rprichard requested review of this revision.
Herald added a project: libc++abi.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++abi.
Sometimes libc++'s stddef.h wrapper gets included, which defines
::nullptr_t. This test is compiled with -Wshadow -Werror, so shadowing
::nullptr_t with a nullptr_t in main is an error. Include cstddef,
which is guaranteed to define std::nullptr_t in C++11 and forward.
Repository:
rG LLVM Github Monorepo
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
@@ -10,6 +10,7 @@
// UNSUPPORTED: no-exceptions
#include <cassert>
+#include <cstddef>
#include <cstdlib>
struct A {};
@@ -27,13 +28,11 @@
int main(int, char**)
{
- using 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.472163.patch
Type: text/x-patch
Size: 954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221031/5f446842/attachment.bin>
More information about the libcxx-commits
mailing list