Fix PR26103 - Error calling is_convertible with incomplete type. Patch from Michael Daniels.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@258852 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1347,10 +1347,9 @@ struct __is_convertible_test : public false_type {};
|
|||||||
|
|
||||||
template <class _From, class _To>
|
template <class _From, class _To>
|
||||||
struct __is_convertible_test<_From, _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
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
template <class _Tp> _Tp&& __source();
|
template <class _Tp> _Tp&& __source();
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -52,6 +52,11 @@ class NonCopyable {
|
|||||||
NonCopyable(NonCopyable&);
|
NonCopyable(NonCopyable&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class CannotInstantiate {
|
||||||
|
enum { X = T::ThisExpressionWillBlowUp };
|
||||||
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// void
|
// void
|
||||||
@@ -206,4 +211,7 @@ int main()
|
|||||||
test_is_not_convertible<NonCopyable&, NonCopyable>();
|
test_is_not_convertible<NonCopyable&, NonCopyable>();
|
||||||
#endif
|
#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), "");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user