aboutsummaryrefslogtreecommitdiff
path: root/libcxx
diff options
context:
space:
mode:
authorLouis Dionne <ldionne@apple.com>2019-07-16 21:13:40 +0000
committerLouis Dionne <ldionne@apple.com>2019-07-16 21:13:40 +0000
commite559f62506423d5df23355862e11d233ff3c5242 (patch)
tree8081f61b5520cc392bdff16fc6880d15e103d295 /libcxx
parent588fc9e756d3c9981cf7b17f18bd199e7bcd4172 (diff)
downloadllvm-e559f62506423d5df23355862e11d233ff3c5242.zip
llvm-e559f62506423d5df23355862e11d233ff3c5242.tar.gz
llvm-e559f62506423d5df23355862e11d233ff3c5242.tar.bz2
[libcxx] Rejigger test for destroying delete feature-test macros
In r361572, we introduced library support for C++20 destroying delete and decided to only define the library feature-test macro when the compiler supports the underlying language feature. This patch reworks the tests to mirror that. llvm-svn: 366263
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/test/std/language.support/support.dynamic/destroying_delete_t.pass.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/libcxx/test/std/language.support/support.dynamic/destroying_delete_t.pass.cpp b/libcxx/test/std/language.support/support.dynamic/destroying_delete_t.pass.cpp
index 834222c..fa4e77c 100644
--- a/libcxx/test/std/language.support/support.dynamic/destroying_delete_t.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/destroying_delete_t.pass.cpp
@@ -52,10 +52,19 @@ void A::operator delete(A* a, std::destroying_delete_t) {
::operator delete(a);
}
-#ifndef __cpp_lib_destroying_delete
-#error "Expected __cpp_lib_destroying_delete to be defined"
-#elif __cpp_lib_destroying_delete < 201806L
-#error "Unexpected value of __cpp_lib_destroying_delete"
+// Only test the definition of the library feature-test macro when the compiler
+// supports the feature -- otherwise we don't define the library feature-test
+// macro.
+#if defined(__cpp_impl_destroying_delete)
+# if !defined(__cpp_lib_destroying_delete)
+# error "Expected __cpp_lib_destroying_delete to be defined"
+# elif __cpp_lib_destroying_delete < 201806L
+# error "Unexpected value of __cpp_lib_destroying_delete"
+# endif
+#else
+# if defined(__cpp_lib_destroying_delete)
+# error "The library feature-test macro for destroying delete shouldn't be defined when the compiler doesn't support the language feature"
+# endif
#endif
int main() {