[libcxx] r266586 - Add tests for LWG issue 2361
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 17 19:31:12 PDT 2016
Author: ericwf
Date: Sun Apr 17 21:31:05 2016
New Revision: 266586
URL: http://llvm.org/viewvc/llvm-project?rev=266586&view=rev
Log:
Add tests for LWG issue 2361
Modified:
libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp
libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp
libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp
libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp
libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp
libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp
libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp
libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp
libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp
libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp
libcxx/trunk/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp
libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp
libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp
libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
libcxx/trunk/www/cxx1z_status.html
Modified: libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp?rev=266586&r1=266585&r2=266586&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp Sun Apr 17 21:31:05 2016
@@ -20,6 +20,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct Ptr {};
@@ -47,9 +49,19 @@ struct C
typedef CPtr<const T> const_pointer;
};
+template <class T>
+struct D {
+ typedef T value_type;
+private:
+ typedef void const_pointer;
+};
+
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::const_pointer, Ptr<const char> >::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::const_pointer, const char*>::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::const_pointer, CPtr<const char> >::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<D<char> >::const_pointer, const char*>::value), "");
+#endif
}
Modified: libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp?rev=266586&r1=266585&r2=266586&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp Sun Apr 17 21:31:05 2016
@@ -21,6 +21,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct Ptr {};
@@ -47,9 +49,21 @@ struct C
typedef CPtr<const void> const_void_pointer;
};
+
+template <class T>
+struct D
+{
+ typedef T value_type;
+private:
+ typedef int const_void_pointer;
+};
+
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::const_void_pointer, Ptr<const void> >::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::const_void_pointer, const void*>::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::const_void_pointer, CPtr<const void> >::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<D<char> >::const_void_pointer, const void*>::value), "");
+#endif
}
Modified: libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp?rev=266586&r1=266585&r2=266586&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp Sun Apr 17 21:31:05 2016
@@ -20,6 +20,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -43,6 +45,15 @@ struct C
struct const_void_pointer {};
};
+
+template <class T>
+struct D
+{
+ typedef T value_type;
+private:
+ typedef void difference_type;
+};
+
namespace std
{
@@ -59,4 +70,7 @@ int main()
static_assert((std::is_same<std::allocator_traits<A<char> >::difference_type, short>::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::difference_type, std::ptrdiff_t>::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::difference_type, signed char>::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<D<char> >::difference_type, std::ptrdiff_t>::value), "");
+#endif
}
Modified: libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp?rev=266586&r1=266585&r2=266586&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp Sun Apr 17 21:31:05 2016
@@ -19,6 +19,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct Ptr {};
@@ -35,8 +37,18 @@ struct B
typedef T value_type;
};
+template <class T>
+struct C {
+ typedef T value_type;
+private:
+ typedef void pointer;
+};
+
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::pointer, Ptr<char> >::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::pointer, char*>::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<C<char> >::pointer, char*>::value), "");
+#endif
}
Modified: libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp?rev=266586&r1=266585&r2=266586&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp Sun Apr 17 21:31:05 2016
@@ -20,6 +20,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -33,8 +35,20 @@ struct B
typedef T value_type;
};
+
+template <class T>
+struct C
+{
+ typedef T value_type;
+private:
+ typedef std::true_type propagate_on_container_copy_assignment;
+};
+
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_copy_assignment, std::true_type>::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::propagate_on_container_copy_assignment, std::false_type>::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<C<char> >::propagate_on_container_copy_assignment, std::false_type>::value), "");
+#endif
}
Modified: libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp?rev=266586&r1=266585&r2=266586&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp Sun Apr 17 21:31:05 2016
@@ -20,6 +20,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -33,8 +35,21 @@ struct B
typedef T value_type;
};
+
+template <class T>
+struct C
+{
+ typedef T value_type;
+private:
+ typedef std::true_type propagate_on_container_move_assignment;
+};
+
+
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_move_assignment, std::true_type>::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::propagate_on_container_move_assignment, std::false_type>::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<C<char> >::propagate_on_container_move_assignment, std::false_type>::value), "");
+#endif
}
Modified: libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp?rev=266586&r1=266585&r2=266586&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp Sun Apr 17 21:31:05 2016
@@ -20,6 +20,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -33,8 +35,19 @@ struct B
typedef T value_type;
};
+template <class T>
+struct C
+{
+ typedef T value_type;
+private:
+ typedef std::true_type propagate_on_container_swap;
+};
+
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_swap, std::true_type>::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::propagate_on_container_swap, std::false_type>::value), "");
+ #if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<C<char> >::propagate_on_container_swap, std::false_type>::value), "");
+#endif
}
Modified: libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp?rev=266586&r1=266585&r2=266586&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp Sun Apr 17 21:31:05 2016
@@ -19,6 +19,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct ReboundA {};
@@ -61,19 +63,39 @@ struct E
template <class U> struct rebind {typedef ReboundA<U> otter;};
};
+template <class T>
+struct F {
+ typedef T value_type;
+private:
+ template <class>
+ struct rebind { typedef void other; };
+};
+
+template <class T>
+struct G {
+ typedef T value_type;
+ template <class>
+ struct rebind {
+ private:
+ typedef void other;
+ };
+};
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#if TEST_STD_VER >= 11
static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_alloc<double>, ReboundA<double> >::value), "");
static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_alloc<double>, ReboundB<double, char> >::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_alloc<double>, C<double> >::value), "");
static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_alloc<double>, D<double, char> >::value), "");
static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_alloc<double>, E<double> >::value), "");
-#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+ static_assert((std::is_same<std::allocator_traits<F<char> >::rebind_alloc<double>, F<double> >::value), "");
+ static_assert((std::is_same<std::allocator_traits<G<char> >::rebind_alloc<double>, G<double> >::value), "");
+#else
static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_alloc<double>::other, ReboundA<double> >::value), "");
static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_alloc<double>::other, ReboundB<double, char> >::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_alloc<double>::other, C<double> >::value), "");
static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_alloc<double>::other, D<double, char> >::value), "");
static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_alloc<double>::other, E<double> >::value), "");
-#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#endif
}
Modified: libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp?rev=266586&r1=266585&r2=266586&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp Sun Apr 17 21:31:05 2016
@@ -19,6 +19,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -42,6 +44,14 @@ struct C
struct const_void_pointer {};
};
+template <class T>
+struct D {
+ typedef T value_type;
+ typedef short difference_type;
+private:
+ typedef void size_type;
+};
+
namespace std
{
@@ -60,4 +70,7 @@ int main()
std::make_unsigned<std::ptrdiff_t>::type>::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::size_type,
unsigned char>::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<D<char> >::size_type, unsigned short>::value), "");
+#endif
}
Modified: libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp?rev=266586&r1=266585&r2=266586&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp Sun Apr 17 21:31:05 2016
@@ -20,6 +20,7 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
template <class T>
struct Ptr {};
@@ -47,9 +48,21 @@ struct C
typedef CPtr<void> void_pointer;
};
+
+template <class T>
+struct D
+{
+ typedef T value_type;
+private:
+ typedef void void_pointer;
+};
+
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::void_pointer, Ptr<void> >::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::void_pointer, void*>::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::void_pointer, CPtr<void> >::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::allocator_traits<D<char> >::void_pointer, void*>::value), "");
+#endif
}
Modified: libcxx/trunk/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp?rev=266586&r1=266585&r2=266586&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp Sun Apr 17 21:31:05 2016
@@ -14,6 +14,8 @@
#include <memory>
#include <vector>
+#include "test_macros.h"
+
struct A
{
};
@@ -23,6 +25,19 @@ struct B
typedef int allocator_type;
};
+struct C {
+ static int allocator_type;
+};
+
+struct D {
+ static int allocator_type() {}
+};
+
+struct E {
+private:
+ typedef int allocator_type;
+};
+
int main()
{
static_assert((!std::uses_allocator<int, std::allocator<int> >::value), "");
@@ -30,4 +45,9 @@ int main()
static_assert((!std::uses_allocator<A, std::allocator<int> >::value), "");
static_assert((!std::uses_allocator<B, std::allocator<int> >::value), "");
static_assert(( std::uses_allocator<B, double>::value), "");
+ static_assert((!std::uses_allocator<C, decltype(C::allocator_type)>::value), "");
+ static_assert((!std::uses_allocator<D, decltype(D::allocator_type)>::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((!std::uses_allocator<E, int>::value), "");
+#endif
}
Modified: libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp?rev=266586&r1=266585&r2=266586&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp Sun Apr 17 21:31:05 2016
@@ -19,6 +19,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
struct A
{
typedef short element_type;
@@ -39,10 +41,26 @@ struct D
typedef char difference_type;
};
+template <class T>
+struct E
+{
+ static int difference_type;
+};
+
+template <class T>
+struct F {
+private:
+ typedef int difference_type;
+};
+
int main()
{
static_assert((std::is_same<std::pointer_traits<A>::difference_type, char>::value), "");
static_assert((std::is_same<std::pointer_traits<B>::difference_type, std::ptrdiff_t>::value), "");
static_assert((std::is_same<std::pointer_traits<C<double> >::difference_type, std::ptrdiff_t>::value), "");
static_assert((std::is_same<std::pointer_traits<D<int> >::difference_type, char>::value), "");
+ static_assert((std::is_same<std::pointer_traits<E<int> >::difference_type, std::ptrdiff_t>::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::pointer_traits<F<int>>::difference_type, std::ptrdiff_t>::value), "");
+#endif
}
Modified: libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp?rev=266586&r1=266585&r2=266586&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp Sun Apr 17 21:31:05 2016
@@ -40,10 +40,27 @@ struct D
{
};
+template <class T, class U>
+struct E
+{
+ static int element_type;
+};
+
+template <class T>
+struct F {
+private:
+ typedef int element_type;
+};
+
int main()
{
static_assert((std::is_same<std::pointer_traits<A>::element_type, char>::value), "");
static_assert((std::is_same<std::pointer_traits<B<int> >::element_type, char>::value), "");
static_assert((std::is_same<std::pointer_traits<C<int> >::element_type, int>::value), "");
static_assert((std::is_same<std::pointer_traits<D<double, int> >::element_type, double>::value), "");
+ static_assert((std::is_same<std::pointer_traits<E<double, int> >::element_type, double>::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((std::is_same<std::pointer_traits<F<double>>::element_type, double>::value), "");
+#endif
+
}
Modified: libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp?rev=266586&r1=266585&r2=266586&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp Sun Apr 17 21:31:05 2016
@@ -19,6 +19,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -29,7 +31,7 @@ template <class T> struct B1 {};
template <class T>
struct B
{
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#if TEST_STD_VER >= 11
template <class U> using rebind = B1<U>;
#else
template <class U> struct rebind {typedef B1<U> other;};
@@ -46,24 +48,58 @@ template <class T, class U> struct D1 {}
template <class T, class U>
struct D
{
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#if TEST_STD_VER >= 11
template <class V> using rebind = D1<V, U>;
#else
template <class V> struct rebind {typedef D1<V, U> other;};
#endif
};
+template <class T, class U>
+struct E
+{
+ template <class>
+ void rebind() {}
+};
+
+
+#if TEST_STD_VER >= 11
+template <class T, class U>
+struct F {
+private:
+ template <class>
+ using rebind = void;
+};
+#endif
+
+#if TEST_STD_VER >= 14
+template <class T, class U>
+struct G
+{
+ template <class>
+ static constexpr int rebind = 42;
+};
+#endif
+
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#if TEST_STD_VER >= 11
static_assert((std::is_same<std::pointer_traits<A<int*> >::rebind<double*>, A<double*> >::value), "");
static_assert((std::is_same<std::pointer_traits<B<int> >::rebind<double>, B1<double> >::value), "");
static_assert((std::is_same<std::pointer_traits<C<char, int> >::rebind<double>, C<double, int> >::value), "");
static_assert((std::is_same<std::pointer_traits<D<char, int> >::rebind<double>, D1<double, int> >::value), "");
-#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+ static_assert((std::is_same<std::pointer_traits<E<char, int> >::rebind<double>, E<double, int> >::value), "");
+ static_assert((std::is_same<std::pointer_traits<F<char, int> >::rebind<double>, F<double, int> >::value), "");
+
+#if TEST_STD_VER >= 14
+ static_assert((std::is_same<std::pointer_traits<G<char, int> >::rebind<double>, G<double, int> >::value), "");
+#endif
+#else // TEST_STD_VER < 11
static_assert((std::is_same<std::pointer_traits<A<int*> >::rebind<double*>::other, A<double*> >::value), "");
static_assert((std::is_same<std::pointer_traits<B<int> >::rebind<double>::other, B1<double> >::value), "");
static_assert((std::is_same<std::pointer_traits<C<char, int> >::rebind<double>::other, C<double, int> >::value), "");
static_assert((std::is_same<std::pointer_traits<D<char, int> >::rebind<double>::other, D1<double, int> >::value), "");
-#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+ static_assert((std::is_same<std::pointer_traits<E<char, int> >::rebind<double>::other, E<double, int> >::value), "");
+#endif
}
Modified: libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp?rev=266586&r1=266585&r2=266586&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp Sun Apr 17 21:31:05 2016
@@ -16,11 +16,22 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
struct Deleter
{
struct pointer {};
};
+struct D2 {
+private:
+ typedef void pointer;
+};
+
+struct D3 {
+ static long pointer;
+};
+
int main()
{
{
@@ -31,4 +42,14 @@ int main()
typedef std::unique_ptr<int, Deleter> P;
static_assert((std::is_same<P::pointer, Deleter::pointer>::value), "");
}
+#if TEST_STD_VER >= 11
+ {
+ typedef std::unique_ptr<int, D2> P;
+ static_assert(std::is_same<P::pointer, int*>::value, "");
+
+ {
+ typedef std::unique_ptr<int, D3> P;
+ static_assert(std::is_same<P::pointer, int*>::value, "");
+ }}
+#endif
}
Modified: libcxx/trunk/www/cxx1z_status.html
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=266586&r1=266585&r2=266586&view=diff
==============================================================================
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Sun Apr 17 21:31:05 2016
@@ -122,7 +122,7 @@
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2233">2233</td><td><code>bad_function_call::what()</code> unhelpful</td><td>Urbana</td><td>Complete</td></tr>
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2266">2266</td><td><code>vector</code> and <code>deque</code> have incorrect insert requirements</td><td>Urbana</td><td>Complete</td></tr>
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2325">2325</td><td><code>minmax_element()</code>'s behavior differing from <code>max_element()</code>'s should be noted</td><td>Urbana</td><td>Complete</td></tr>
- <tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2361">2361</td><td>Apply 2299 resolution throughout library</td><td>Urbana</td><td></td></tr>
+ <tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2361">2361</td><td>Apply 2299 resolution throughout library</td><td>Urbana</td><td>Complete</td></tr>
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2365">2365</td><td>Missing noexcept in <code>shared_ptr::shared_ptr(nullptr_t)</code></td><td>Urbana</td><td>Complete</td></tr>
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2376">2376</td><td><code>bad_weak_ptr::what()</code> overspecified</td><td>Urbana</td><td>Complete</td></tr>
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2387">2387</td><td>More nested types that must be accessible and unambiguous</td><td>Urbana</td><td>Complete</td></tr>
More information about the cfe-commits
mailing list