Skip to content

Commit 7e672ca

Browse files
committed
tests: support C++23 in tests
Signed-off-by: Henry Schreiner <[email protected]>
1 parent ef2ad42 commit 7e672ca

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/pure_cpp/smart_holder_poc_test.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "smart_holder_poc.h"
22

3+
#include <cstddef>
34
#include <functional>
45
#include <memory>
56
#include <type_traits>
@@ -380,8 +381,17 @@ TEST_CASE("error_cannot_disown_nullptr", "[E]") {
380381

381382
TEST_CASE("indestructible_int-from_raw_ptr_unowned+as_raw_ptr_unowned", "[S]") {
382383
using zombie = helpers::indestructible_int;
384+
385+
// This is from C++17
386+
#ifdef __cpp_lib_byte
387+
using raw_byte = std::byte;
388+
#else
389+
using raw_byte = char;
390+
#endif
391+
383392
// Using placement new instead of plain new, to not trigger leak sanitizer errors.
384-
static std::aligned_storage<sizeof(zombie), alignof(zombie)>::type memory_block[1];
393+
alignas(zombie) raw_byte memory_block[sizeof(zombie)];
394+
385395
auto *value = new (memory_block) zombie(19);
386396
auto hld = smart_holder::from_raw_ptr_unowned(value);
387397
REQUIRE(hld.as_raw_ptr_unowned<zombie>()->valu == 19);

0 commit comments

Comments
 (0)