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 }