From 602fe15f55ea6166eeb26b3226d311eed4b55767 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. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276599 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/type_traits | 21 +++++-------------- .../meta.unary.prop/is_assignable.pass.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/include/type_traits b/include/type_traits index 14ed698df..0d578bbe0 100644 --- a/include/type_traits +++ b/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/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp index b734a1aa6..f4736e713 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp +++ b/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(); }