<div dir="ltr">@Hans Where are we in the release process? I would like to merge this into 4.0. <div><br></div><div>Although it's not a regression, it is a significant bug. This patch fixes the bug by</div><div>forwarding to a compiler builtin, which is strictly better than what we have. I'm</div><div>confident this patch is safe.</div><div><br></div><div>/Eric</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 28, 2017 at 6:27 PM, Eric Fiselier via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ericwf<br>
Date: Tue Feb 28 19:27:14 2017<br>
New Revision: 296561<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=296561&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=296561&view=rev</a><br>
Log:<br>
Fix PR32097 - is_abstract doesn't work on class templates.<br>
<br>
This patch fixes <a href="http://llvm.org/PR32097" rel="noreferrer" target="_blank">llvm.org/PR32097</a> by using the __is_abstract<br>
builtin type-trait instead of the previous library-only implementation.<br>
<br>
All supported compilers provide this trait. I've tested as far<br>
back as Clang 3.2, GCC 4.6 and MSVC trunk.<br>
<br>
Modified:<br>
libcxx/trunk/include/type_<wbr>traits<br>
libcxx/trunk/test/std/<wbr>utilities/meta/meta.unary/<wbr>meta.unary.prop/is_abstract.<wbr>pass.cpp<br>
<br>
Modified: libcxx/trunk/include/type_<wbr>traits<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=296561&r1=296560&r2=296561&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/include/<wbr>type_traits?rev=296561&r1=<wbr>296560&r2=296561&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/include/type_<wbr>traits (original)<br>
+++ libcxx/trunk/include/type_<wbr>traits Tue Feb 28 19:27:14 2017<br>
@@ -1297,18 +1297,8 @@ template <class _Tp> using decay_t = typ<br>
<br>
// is_abstract<br>
<br>
-namespace __is_abstract_imp<br>
-{<br>
-template <class _Tp> char __test(_Tp (*)[1]);<br>
-template <class _Tp> __two __test(...);<br>
-}<br>
-<br>
-template <class _Tp, bool = is_class<_Tp>::value><br>
-struct __libcpp_abstract : public integral_constant<bool, sizeof(__is_abstract_imp::__<wbr>test<_Tp>(0)) != 1> {};<br>
-<br>
-template <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {};<br>
-<br>
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract : public __libcpp_abstract<_Tp> {};<br>
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract<br>
+ : public integral_constant<bool, __is_abstract(_Tp)> {};<br>
<br>
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_<wbr>VARIABLE_TEMPLATES)<br>
template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v<br>
<br>
Modified: libcxx/trunk/test/std/<wbr>utilities/meta/meta.unary/<wbr>meta.unary.prop/is_abstract.<wbr>pass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp?rev=296561&r1=296560&r2=296561&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/std/<wbr>utilities/meta/meta.unary/<wbr>meta.unary.prop/is_abstract.<wbr>pass.cpp?rev=296561&r1=296560&<wbr>r2=296561&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/std/<wbr>utilities/meta/meta.unary/<wbr>meta.unary.prop/is_abstract.<wbr>pass.cpp (original)<br>
+++ libcxx/trunk/test/std/<wbr>utilities/meta/meta.unary/<wbr>meta.unary.prop/is_abstract.<wbr>pass.cpp Tue Feb 28 19:27:14 2017<br>
@@ -65,6 +65,14 @@ class Abstract<br>
virtual ~Abstract() = 0;<br>
};<br>
<br>
+template <class><br>
+struct AbstractTemplate {<br>
+ virtual void test() = 0;<br>
+};<br>
+<br>
+template <><br>
+struct AbstractTemplate<double> {};<br>
+<br>
int main()<br>
{<br>
test_is_not_abstract<void>();<br>
@@ -81,4 +89,6 @@ int main()<br>
test_is_not_abstract<NotEmpty><wbr>();<br>
<br>
test_is_abstract<Abstract>();<br>
+ test_is_abstract<<wbr>AbstractTemplate<int> >();<br>
+ test_is_not_abstract<<wbr>AbstractTemplate<double> >();<br>
}<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>