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:
Martin Hořeňovský 2019-09-06 18:36:59 +02:00
parent 789f3591ef
commit 4038ee6bc6
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
1 changed files with 1 additions and 0 deletions

View File

@ -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 )