From da4d0375f09db9d8950f84d7ecbbb602575cd302 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sat, 11 Jul 2026 11:29:33 +0100 Subject: [PATCH] Make __builtin_launder test code C++03. --- test/boost_has_builtin_launder.ipp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/boost_has_builtin_launder.ipp b/test/boost_has_builtin_launder.ipp index f20aab97..4c29e160 100644 --- a/test/boost_has_builtin_launder.ipp +++ b/test/boost_has_builtin_launder.ipp @@ -12,18 +12,21 @@ #include namespace boost_has_builtin_launder { - +// +// This is intensionally C++03 code as __builtin_launder can be used even when std::launder +// isn't available (ie pre-C++17). struct X { const int const_int; - X() = delete; + X() : const_int(0) {}; X(const int i) : const_int(i) {} + X(const X& o) : const_int(o.const_int) {}; }; int test() { - X original{1}; - new (&original) X{2}; //Overwrite X + X original(1); + new (&original) X(2); //Overwrite X return __builtin_launder(&original)->const_int == 2 ? 0 : -1; //After laundering, new value should be returned }