[libcxx] r276092 - Unbreak is_constructible tests for Clang <= 3.7.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 19 23:36:11 PDT 2016


Author: ericwf
Date: Wed Jul 20 01:36:11 2016
New Revision: 276092

URL: http://llvm.org/viewvc/llvm-project?rev=276092&view=rev
Log:
Unbreak is_constructible tests for Clang <= 3.7.

There is a bug in Clang's __is_constructible builtin that causes it
to return true for function types; ex [T = void()].



Modified:
    libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
    libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp

Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp?rev=276092&r1=276091&r2=276092&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp Wed Jul 20 01:36:11 2016
@@ -151,9 +151,21 @@ int main()
     test_is_constructible<PrivateDtor&, PrivateDtor&>();
     test_is_not_constructible<PrivateDtor, int>();
 
+    test_is_not_constructible<void() const, void() const>();
+    test_is_not_constructible<void() const, void*>();
+
+// TODO: Remove this workaround once Clang <= 3.7 are no longer used regularly.
+// In those compiler versions the __is_constructible builtin gives the wrong
+// results for abominable function types.
+#if defined(__clang__) && __clang_major__ == 3 && __clang_minor__ < 8
+#define WORKAROUND_CLANG_BUG
+#endif
+#if !defined(WORKAROUND_CLANG_BUG)
+    test_is_not_constructible<void()>();
     test_is_not_constructible<void() const> ();
     test_is_not_constructible<void() volatile> ();
     test_is_not_constructible<void() &> ();
     test_is_not_constructible<void() &&> ();
 #endif
+#endif
 }

Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp?rev=276092&r1=276091&r2=276092&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp Wed Jul 20 01:36:11 2016
@@ -107,7 +107,19 @@ int main()
 #if TEST_STD_VER >= 11
     test_is_not_default_constructible<B>();
     test_is_not_default_constructible<int&&>();
+
+// TODO: Remove this workaround once Clang <= 3.7 are no longer used regularly.
+// In those compiler versions the __is_constructible builtin gives the wrong
+// results for abominable function types.
+#if defined(__clang__) && __clang_major__ == 3 && __clang_minor__ < 8
+#define WORKAROUND_CLANG_BUG
+#endif
+#if !defined(WORKAROUND_CLANG_BUG)
     test_is_not_default_constructible<void()>();
-    test_is_not_default_constructible<void() const>();
+    test_is_not_default_constructible<void() const> ();
+    test_is_not_default_constructible<void() volatile> ();
+    test_is_not_default_constructible<void() &> ();
+    test_is_not_default_constructible<void() &&> ();
+#endif
 #endif
 }




More information about the cfe-commits mailing list