diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-01-26 20:24:30 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-01-26 20:24:30 +0000 |
commit | 060cc200d05f461ede7bb066d94f854e3481e6ea (patch) | |
tree | 6e711415c3a9c186056b0c3afe4df2ad79f47ee1 | |
parent | 1a6c7608b1f47dadf7adae8dbc1fb8345f7ff15e (diff) | |
download | bcm5719-llvm-060cc200d05f461ede7bb066d94f854e3481e6ea.tar.gz bcm5719-llvm-060cc200d05f461ede7bb066d94f854e3481e6ea.zip |
Fix PR26103 - Error calling is_convertible with incomplete type. Patch from Michael Daniels.
llvm-svn: 258852
-rw-r--r-- | libcxx/include/type_traits | 3 | ||||
-rw-r--r-- | libcxx/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index f13e29f971b..3c9e8dd9021 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -1347,10 +1347,9 @@ struct __is_convertible_test : public false_type {}; 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 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 1681c39972d..144c292b84c 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 @@ -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), ""); } |