[libcxx-commits] [libcxx] adadc66 - [libc++] Add test and remove workaround for PR13592

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 30 15:52:18 PDT 2019


Author: Louis Dionne
Date: 2019-10-30T15:52:11-07:00
New Revision: adadc665f83a588e2cbcb5e9f4675d1a5c5cda2d

URL: https://github.com/llvm/llvm-project/commit/adadc665f83a588e2cbcb5e9f4675d1a5c5cda2d
DIFF: https://github.com/llvm/llvm-project/commit/adadc665f83a588e2cbcb5e9f4675d1a5c5cda2d.diff

LOG: [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).

Added: 
    

Modified: 
    libcxx/include/type_traits
    libcxx/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index aa1fab3bcf8c..54aa93fabffd 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 f299c5fb1cac..804650fde3f3 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;
 }


        


More information about the libcxx-commits mailing list