diff options
| author | Louis Dionne <ldionne@apple.com> | 2018-11-13 17:04:05 +0000 |
|---|---|---|
| committer | Louis Dionne <ldionne@apple.com> | 2018-11-13 17:04:05 +0000 |
| commit | 727202699335fcba44e8c90ce29b6cab5e1b61fb (patch) | |
| tree | 2aeb4f9ffcffb314283435e16624c4b2c1d1d964 /libcxx/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp | |
| parent | c9c6212f6f6ef53d20fb2d8011e792ed623cdaa5 (diff) | |
| download | bcm5719-llvm-727202699335fcba44e8c90ce29b6cab5e1b61fb.tar.gz bcm5719-llvm-727202699335fcba44e8c90ce29b6cab5e1b61fb.zip | |
[libcxx] Implement http://wg21.link/p1006, constexpr in pointer_traits
Summary:
P1006 adds support for constexpr in the specialization of pointer_traits
for raw pointers. This is necessary in order to use pointer_traits in
the upcoming constexpr containers. We expect P1006 to be voted into the
working draft for C++20 at the San Diego meeting.
Reviewers: mclow.lists, EricWF
Subscribers: christof, dexonsmith, libcxx-commits
Differential Revision: https://reviews.llvm.org/D53867
llvm-svn: 346764
Diffstat (limited to 'libcxx/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp')
| -rw-r--r-- | libcxx/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libcxx/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp b/libcxx/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp index b3f3c24020d..756f8942969 100644 --- a/libcxx/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp +++ b/libcxx/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp @@ -12,15 +12,18 @@ // template <class T> // struct pointer_traits<T*> // { -// static pointer pointer_to(<details>); +// static pointer pointer_to(<details>); // constexpr in C++20 // ... // }; #include <memory> #include <cassert> +#include "test_macros.h" -int main() -{ +#if TEST_STD_VER > 17 +constexpr +#endif +bool check() { { int i = 0; static_assert((std::is_same<int *, decltype(std::pointer_traits<int*>::pointer_to(i))>::value), ""); @@ -30,4 +33,12 @@ int main() { (std::pointer_traits<void*>::element_type)0; } + return true; +} + +int main() { + check(); +#if TEST_STD_VER > 17 + static_assert(check(), ""); +#endif } |

