summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2017-05-03 19:50:39 +0000
committerEric Fiselier <eric@efcs.ca>2017-05-03 19:50:39 +0000
commit2a0436688e5f1cf233b5cef9d9d0a4dc6acf8a97 (patch)
treece1f1a1252ae85393af52c45844e4e243edda0d6
parent8ad4f502b5b6b3cb5b5cc88827e52a27248e6448 (diff)
Merge r296561 - Fix PR32097 - is_abstract doesn't work on class templates.release_40
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/release_40@302071 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/type_traits14
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp10
2 files changed, 12 insertions, 12 deletions
diff --git a/include/type_traits b/include/type_traits
index 786295560..3aa84605a 100644
--- a/include/type_traits
+++ b/include/type_traits
@@ -1297,18 +1297,8 @@ template <class _Tp> using decay_t = typename decay<_Tp>::type;
// is_abstract
-namespace __is_abstract_imp
-{
-template <class _Tp> char __test(_Tp (*)[1]);
-template <class _Tp> __two __test(...);
-}
-
-template <class _Tp, bool = is_class<_Tp>::value>
-struct __libcpp_abstract : public integral_constant<bool, sizeof(__is_abstract_imp::__test<_Tp>(0)) != 1> {};
-
-template <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {};
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract : public __libcpp_abstract<_Tp> {};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract
+ : public integral_constant<bool, __is_abstract(_Tp)> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp
index a54adf102..99ca74cc2 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp
@@ -65,6 +65,14 @@ class Abstract
virtual ~Abstract() = 0;
};
+template <class>
+struct AbstractTemplate {
+ virtual void test() = 0;
+};
+
+template <>
+struct AbstractTemplate<double> {};
+
int main()
{
test_is_not_abstract<void>();
@@ -81,4 +89,6 @@ int main()
test_is_not_abstract<NotEmpty>();
test_is_abstract<Abstract>();
+ test_is_abstract<AbstractTemplate<int> >();
+ test_is_not_abstract<AbstractTemplate<double> >();
}