Skip to content

Commit

Permalink
ObjectStorage: port away from std::aligned_storage
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
marcmutz committed May 9, 2022
1 parent d71b461 commit 8b921e1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions include/internal/benchmark/catch_constructor.hpp
Expand Up @@ -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)
Expand Down Expand Up @@ -64,7 +62,7 @@ namespace Catch {
}


TStorage data;
struct { alignas(T) unsigned char data[sizeof(T)]; } data;
};
}

Expand Down

0 comments on commit 8b921e1

Please sign in to comment.