mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-23 03:43:28 +01:00
Stop compilation if registering an enum could truncate its value
We probably want to use a bigger type (e.g. `int64_t`) later on, but the is a mess right now anyway.
This commit is contained in:
parent
789f3591ef
commit
4038ee6bc6
@ -32,6 +32,7 @@ namespace Catch {
|
||||
|
||||
template<typename E>
|
||||
Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::initializer_list<E> values ) {
|
||||
static_assert(sizeof(int) >= sizeof(E), "Cannot serialize enum to int");
|
||||
std::vector<int> intValues;
|
||||
intValues.reserve( values.size() );
|
||||
for( auto enumValue : values )
|
||||
|
Loading…
Reference in New Issue
Block a user