From ca455815fdbe7774ef81fed497f0026cd5bc3965 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 7 May 2022 11:41:38 +0200 Subject: [PATCH] ObjectStorage: port away from std::aligned_storage It's deprecated in C++23. Just use alignas on a char array, wrapped in a struct to avoid decaying to char*, which is the canonical implementation of aligned_storage: https://en.cppreference.com/w/cpp/types/aligned_storage#Possible_implementation Fixes #2419 Catch3 is not affected. --- include/internal/benchmark/catch_constructor.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/internal/benchmark/catch_constructor.hpp b/include/internal/benchmark/catch_constructor.hpp index 4fc04042..976a1eeb 100644 --- a/include/internal/benchmark/catch_constructor.hpp +++ b/include/internal/benchmark/catch_constructor.hpp @@ -19,8 +19,6 @@ namespace Catch { template struct ObjectStorage { - using TStorage = typename std::aligned_storage::value>::type; - ObjectStorage() : data() {} ObjectStorage(const ObjectStorage& other) @@ -64,7 +62,7 @@ namespace Catch { } - TStorage data; + struct { alignas(T) unsigned char data[sizeof(T)]; } data; }; }