summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Dionne <ldionne@apple.com>2019-10-30 15:49:04 -0700
committerLouis Dionne <ldionne@apple.com>2019-10-30 15:52:11 -0700
commitadadc665f83a588e2cbcb5e9f4675d1a5c5cda2d (patch)
treecf1a45d2d8fbce3f5e946ea601f46e9e32f937ad
parent52194350cfe834f27e41771c315fe0656067fdc4 (diff)
downloadbcm5719-llvm-adadc665f83a588e2cbcb5e9f4675d1a5c5cda2d.tar.gz
bcm5719-llvm-adadc665f83a588e2cbcb5e9f4675d1a5c5cda2d.zip
[libc++] Add test and remove workaround for PR13592
PR13592 was caused by a problem in how to compiler implemented the __is_convertible_to intrinsic. That problem, reported as PR13591, was fixed back in 2012. We don't support such old versions of Clang anyway, so we don't need the library workaround that had been added to solve PR13592 (while waiting for the compiler fix).
-rw-r--r--libcxx/include/type_traits3
-rw-r--r--libcxx/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp12
2 files changed, 10 insertions, 5 deletions
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index aa1fab3bcf8..54aa93fabff 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -1418,8 +1418,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_base_of_v
#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible
- : public integral_constant<bool, __is_convertible_to(_T1, _T2) &&
- !is_abstract<_T2>::value> {};
+ : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};
#else // __has_feature(is_convertible_to)
diff --git a/libcxx/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp b/libcxx/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
index f299c5fb1ca..804650fde3f 100644
--- a/libcxx/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
@@ -60,6 +60,8 @@ class CannotInstantiate {
enum { X = T::ThisExpressionWillBlowUp };
};
+struct abstract { virtual int f() = 0; };
+
int main(int, char**)
{
// void
@@ -244,8 +246,9 @@ int main(int, char**)
static_assert((std::is_convertible<volatile NonCopyable&, const volatile NonCopyable&>::value), "");
static_assert((std::is_convertible<const volatile NonCopyable&, const volatile NonCopyable&>::value), "");
static_assert((!std::is_convertible<const NonCopyable&, NonCopyable&>::value), "");
-// This test requires Access control SFINAE which we only have in C++11 or when
-// we are using the compiler builtin for is_convertible.
+
+ // This test requires Access control SFINAE which we only have in C++11 or when
+ // we are using the compiler builtin for is_convertible.
test_is_not_convertible<NonCopyable&, NonCopyable>();
@@ -253,5 +256,8 @@ int main(int, char**)
// For example CannotInstantiate is instantiated as a part of ADL lookup for arguments of type CannotInstantiate*.
static_assert((std::is_convertible<CannotInstantiate<int>*, CannotInstantiate<int>*>::value), "");
- return 0;
+ // Test for PR13592
+ static_assert(!std::is_convertible<abstract, abstract>::value, "");
+
+ return 0;
}
OpenPOWER on IntegriCloud