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.
This commit is contained in:
Marc Mutz 2022-05-07 11:41:38 +02:00 committed by Martin Hořeňovský
parent d71b4617e9
commit ca455815fd

View File

@ -19,8 +19,6 @@ namespace Catch {
template <typename T, bool Destruct>
struct ObjectStorage
{
using TStorage = typename std::aligned_storage<sizeof(T), std::alignment_of<T>::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;
};
}