Skip to content

Commit e559f62

Browse files
committed
[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
1 parent 588fc9e commit e559f62

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

libcxx/test/std/language.support/support.dynamic/destroying_delete_t.pass.cpp

+13-4
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,19 @@ void A::operator delete(A* a, std::destroying_delete_t) {
5252
::operator delete(a);
5353
}
5454

55-
#ifndef __cpp_lib_destroying_delete
56-
#error "Expected __cpp_lib_destroying_delete to be defined"
57-
#elif __cpp_lib_destroying_delete < 201806L
58-
#error "Unexpected value of __cpp_lib_destroying_delete"
55+
// Only test the definition of the library feature-test macro when the compiler
56+
// supports the feature -- otherwise we don't define the library feature-test
57+
// macro.
58+
#if defined(__cpp_impl_destroying_delete)
59+
# if !defined(__cpp_lib_destroying_delete)
60+
# error "Expected __cpp_lib_destroying_delete to be defined"
61+
# elif __cpp_lib_destroying_delete < 201806L
62+
# error "Unexpected value of __cpp_lib_destroying_delete"
63+
# endif
64+
#else
65+
# if defined(__cpp_lib_destroying_delete)
66+
# error "The library feature-test macro for destroying delete shouldn't be defined when the compiler doesn't support the language feature"
67+
# endif
5968
#endif
6069

6170
int main() {

0 commit comments

Comments
 (0)