diff --git a/test/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp b/test/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp new file mode 100644 index 00000000..537fb901 --- /dev/null +++ b/test/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp @@ -0,0 +1,116 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include +#include + +#if __cplusplus >= 201103L +// #include +// +// template +// struct allocator_traits +// { +// typedef Alloc allocator_type; +// typedef typename allocator_type::value_type +// value_type; +// +// typedef Alloc::pointer | value_type* pointer; +// typedef Alloc::const_pointer +// | pointer_traits::rebind +// const_pointer; +// typedef Alloc::void_pointer +// | pointer_traits::rebind +// void_pointer; +// typedef Alloc::const_void_pointer +// | pointer_traits::rebind +// const_void_pointer; + +template +void test_pointer() +{ + typename std::allocator_traits::pointer vp; + typename std::allocator_traits::const_pointer cvp; + + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same vp)>::value, ""); + static_assert(std::is_same= vp)>::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same cvp)>::value, ""); + static_assert(std::is_same vp)>::value, ""); + static_assert(std::is_same= cvp)>::value, ""); + static_assert(std::is_same= vp)>::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same cvp)>::value, ""); + static_assert(std::is_same= cvp)>::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); +} + +template +void test_void_pointer() +{ + typename std::allocator_traits::void_pointer vp; + typename std::allocator_traits::const_void_pointer cvp; + + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same vp)>::value, ""); + static_assert(std::is_same= vp)>::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same cvp)>::value, ""); + static_assert(std::is_same vp)>::value, ""); + static_assert(std::is_same= cvp)>::value, ""); + static_assert(std::is_same= vp)>::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same cvp)>::value, ""); + static_assert(std::is_same= cvp)>::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); +} + +struct Foo { int x; }; + +int main() +{ + test_pointer>> (); + test_pointer>> (); + test_pointer>> (); + + test_void_pointer>> (); + test_void_pointer>> (); + test_void_pointer>> (); +} +#else +int main() {} +#endif diff --git a/test/utilities/memory/default.allocator/allocator_pointers.pass.cpp b/test/utilities/memory/default.allocator/allocator_pointers.pass.cpp new file mode 100644 index 00000000..b894e45b --- /dev/null +++ b/test/utilities/memory/default.allocator/allocator_pointers.pass.cpp @@ -0,0 +1,116 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include +#include + +#if __cplusplus >= 201103L +// #include +// +// template +// struct allocator_traits +// { +// typedef Alloc allocator_type; +// typedef typename allocator_type::value_type +// value_type; +// +// typedef Alloc::pointer | value_type* pointer; +// typedef Alloc::const_pointer +// | pointer_traits::rebind +// const_pointer; +// typedef Alloc::void_pointer +// | pointer_traits::rebind +// void_pointer; +// typedef Alloc::const_void_pointer +// | pointer_traits::rebind +// const_void_pointer; + +template +void test_pointer() +{ + typename std::allocator_traits::pointer vp; + typename std::allocator_traits::const_pointer cvp; + + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same vp)>::value, ""); + static_assert(std::is_same= vp)>::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same cvp)>::value, ""); + static_assert(std::is_same vp)>::value, ""); + static_assert(std::is_same= cvp)>::value, ""); + static_assert(std::is_same= vp)>::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same cvp)>::value, ""); + static_assert(std::is_same= cvp)>::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); +} + +template +void test_void_pointer() +{ + typename std::allocator_traits::void_pointer vp; + typename std::allocator_traits::const_void_pointer cvp; + + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same vp)>::value, ""); + static_assert(std::is_same= vp)>::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same cvp)>::value, ""); + static_assert(std::is_same vp)>::value, ""); + static_assert(std::is_same= cvp)>::value, ""); + static_assert(std::is_same= vp)>::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same cvp)>::value, ""); + static_assert(std::is_same= cvp)>::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); +} + +struct Foo { int x; }; + +int main() +{ + test_pointer> (); + test_pointer> (); + test_pointer> (); + + test_void_pointer> (); + test_void_pointer> (); + test_void_pointer> (); +} +#else +int main() {} +#endif diff --git a/www/cxx1y_status.html b/www/cxx1y_status.html index 287c754e..8117a65b 100644 --- a/www/cxx1y_status.html +++ b/www/cxx1y_status.html @@ -239,7 +239,7 @@ 2213Return value of std::regex_replaceIssaquahComplete 2258a.erase(q1, q2) unable to directly return q2IssaquahComplete - 2263Comparing iterators and allocator pointers with different const-characterIssaquah + 2263Comparing iterators and allocator pointers with different const-characterIssaquahComplete 2293Wrong facet used by num_put::do_putIssaquahComplete 2301Why is std::tie not constexpr?IssaquahComplete 2304Complexity of count in unordered associative containersIssaquahComplete