]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Adjust testcase for constexpr placement new [PR115744]
authorJonathan Wakely <jwakely@redhat.com>
Tue, 20 Aug 2024 20:47:29 +0000 (21:47 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 20 Aug 2024 20:51:50 +0000 (21:51 +0100)
This test now fails in C++26 mode because the declaration in <new> is
constexpr and the one in the test isn't. Add constexpr to the test.

libstdc++-v3/ChangeLog:

PR libstdc++/115744
* testsuite/18_support/headers/new/synopsis.cc [C++26]: Add
constexpr to placement operator new and operator new[].

libstdc++-v3/testsuite/18_support/headers/new/synopsis.cc

index 5c83956b5845c934944512c7464089731239ac04..479f0df12b5df8d72d8c116c08f0c713e2ceec80 100644 (file)
@@ -46,8 +46,13 @@ void* operator new[](std::size_t size, const std::nothrow_t&) throw();
 void  operator delete[](void* ptr) throw();
 void  operator delete[](void* ptr, const std::nothrow_t&) throw();
 
-void* operator new  (std::size_t size, void* ptr) throw();
-void* operator new[](std::size_t size, void* ptr) throw();
+#if __cplusplus > 202302L
+# define CXX26_CONSTEXPR constexpr
+#else
+# define CXX26_CONSTEXPR
+#endif
+CXX26_CONSTEXPR void* operator new  (std::size_t size, void* ptr) throw();
+CXX26_CONSTEXPR void* operator new[](std::size_t size, void* ptr) throw();
 void  operator delete  (void* ptr, void*) throw();
 void  operator delete[](void* ptr, void*) throw();