mdaniels updated this revision to Diff 45685.
http://reviews.llvm.org/D16344
Files:
include/type_traits
test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
Index: test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
===
--- test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
+++ test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
@@ -52,6 +52,11 @@
NonCopyable(NonCopyable&);
};
+template
+class CannotInstantiate {
+ enum { X = T::ThisExpressionWillBlowUp };
+};
+
int main()
{
// void
@@ -206,4 +211,7 @@
test_is_not_convertible();
#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*>::value), "");
}
Index: include/type_traits
===
--- include/type_traits
+++ include/type_traits
@@ -1347,10 +1347,9 @@
template
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 __two __test(...);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template _Tp&& __source();
#else
Index: test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
===
--- test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
+++ test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
@@ -52,6 +52,11 @@
NonCopyable(NonCopyable&);
};
+template
+class CannotInstantiate {
+ enum { X = T::ThisExpressionWillBlowUp };
+};
+
int main()
{
// void
@@ -206,4 +211,7 @@
test_is_not_convertible();
#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*>::value), "");
}
Index: include/type_traits
===
--- include/type_traits
+++ include/type_traits
@@ -1347,10 +1347,9 @@
template
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 __two __test(...);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template _Tp&& __source();
#else
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits