[libcxx-commits] [libcxx] r366263 - [libcxx] Rejigger test for destroying delete feature-test macros

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 16 14:13:40 PDT 2019


Author: ldionne
Date: Tue Jul 16 14:13:40 2019
New Revision: 366263

URL: http://llvm.org/viewvc/llvm-project?rev=366263&view=rev
Log:
[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.

Modified:
    libcxx/trunk/test/std/language.support/support.dynamic/destroying_delete_t.pass.cpp

Modified: libcxx/trunk/test/std/language.support/support.dynamic/destroying_delete_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/destroying_delete_t.pass.cpp?rev=366263&r1=366262&r2=366263&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/destroying_delete_t.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.dynamic/destroying_delete_t.pass.cpp Tue Jul 16 14:13:40 2019
@@ -52,10 +52,19 @@ void A::operator delete(A* a, std::destr
   ::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() {




More information about the libcxx-commits mailing list