[libcxx] r258852 - Fix PR26103 - Error calling is_convertible with incomplete type. Patch from Michael Daniels.
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 26 12:24:31 PST 2016
Author: ericwf
Date: Tue Jan 26 14:24:30 2016
New Revision: 258852
URL: http://llvm.org/viewvc/llvm-project?rev=258852&view=rev
Log:
Fix PR26103 - Error calling is_convertible with incomplete type. Patch from Michael Daniels.
Modified:
libcxx/trunk/include/type_traits
libcxx/trunk/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=258852&r1=258851&r2=258852&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Tue Jan 26 14:24:30 2016
@@ -1347,10 +1347,9 @@ struct __is_convertible_test : public fa
template <class _From, class _To>
struct __is_convertible_test<_From, _To,
- decltype(__test_convert<_To>(_VSTD::declval<_From>()))> : public true_type
+ decltype(_VSTD::__is_convertible_imp::__test_convert<_To>(_VSTD::declval<_From>()))> : public true_type
{};
-template <class _Tp> __two __test(...);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp> _Tp&& __source();
#else
Modified: libcxx/trunk/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp?rev=258852&r1=258851&r2=258852&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp Tue Jan 26 14:24:30 2016
@@ -52,6 +52,11 @@ class NonCopyable {
NonCopyable(NonCopyable&);
};
+template <typename T>
+class CannotInstantiate {
+ enum { X = T::ThisExpressionWillBlowUp };
+};
+
int main()
{
// void
@@ -206,4 +211,7 @@ int main()
test_is_not_convertible<NonCopyable&, NonCopyable>();
#endif
+ // Ensure that CannotInstantiate is not instantiated by is_convertible when it is not needed.
+ // For example CannotInstantiate is instatiated as a part of ADL lookup for arguments of type CannotInstantiate*.
+ static_assert((std::is_convertible<CannotInstantiate<int>*, CannotInstantiate<int>*>::value), "");
}
More information about the cfe-commits
mailing list