From 79586dca74231f652ad158fca10f6fc56fc94e52 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Mon, 25 Jul 2016 02:08:55 +0000 Subject: [PATCH] Make std::is_assignable tolerate references to incomplete types. llvm-svn: 276599 --- libcxx/include/type_traits | 21 +++++---------------- .../meta.unary.prop/is_assignable.pass.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index 14ed698..0d578bb 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -2036,26 +2036,15 @@ template struct __select_2nd { typedef _Tp type; }; template typename __select_2nd() = _VSTD::declval<_Arg>())), true_type>::type -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -__is_assignable_test(_Tp&&, _Arg&&); -#else -__is_assignable_test(_Tp, _Arg&); -#endif +__is_assignable_test(int); + +template +false_type __is_assignable_test(...); -template -false_type -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -__is_assignable_test(__any, _Arg&&); -#else -__is_assignable_test(__any, _Arg&); -#endif template ::value || is_void<_Arg>::value> struct __is_assignable_imp - : public common_type - < - decltype(_VSTD::__is_assignable_test(declval<_Tp>(), declval<_Arg>())) - >::type {}; + : public decltype((_VSTD::__is_assignable_test<_Tp, _Arg>(0))) {}; template struct __is_assignable_imp<_Tp, _Arg, true> diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp index b734a1a..f4736e7 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp @@ -43,7 +43,7 @@ void test_is_not_assignable() struct D; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 struct C { template @@ -59,6 +59,8 @@ struct E template struct X { T t; }; +struct Incomplete; + int main() { test_is_assignable (); @@ -67,7 +69,7 @@ int main() test_is_assignable (); test_is_assignable (); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test_is_assignable (); test_is_not_assignable (); @@ -80,4 +82,5 @@ int main() // pointer to incomplete template type test_is_assignable*&, X*> (); + test_is_not_assignable(); } -- 2.7.4