mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-03 04:21:13 +00:00
Removed truncating of enum vals to int in ReverseLookup.
Some implementations (e.g. C++98) won't support 64-bit enum values, but there is no reason to silently truncate them. Change-Id: I8629563523a96e887068f9c0efcd53741f60e0d6 Tested: on Linux.
This commit is contained in:
@@ -656,8 +656,8 @@ CheckedError Parser::ParseField(StructDef &struct_def) {
|
||||
if (type.enum_def &&
|
||||
!type.enum_def->is_union &&
|
||||
!type.enum_def->attributes.Lookup("bit_flags") &&
|
||||
!type.enum_def->ReverseLookup(static_cast<int>(
|
||||
StringToInt(field->value.constant.c_str())))) {
|
||||
!type.enum_def->ReverseLookup(StringToInt(
|
||||
field->value.constant.c_str()))) {
|
||||
return Error("default value of " + field->value.constant + " for field " +
|
||||
name + " is not part of enum " + type.enum_def->name);
|
||||
}
|
||||
@@ -668,8 +668,8 @@ CheckedError Parser::ParseField(StructDef &struct_def) {
|
||||
|
||||
if (type.enum_def && IsScalar(type.base_type) && !struct_def.fixed &&
|
||||
!type.enum_def->attributes.Lookup("bit_flags") &&
|
||||
!type.enum_def->ReverseLookup(
|
||||
static_cast<int>(StringToInt(field->value.constant.c_str()))))
|
||||
!type.enum_def->ReverseLookup(StringToInt(
|
||||
field->value.constant.c_str())))
|
||||
Warning("enum " + type.enum_def->name +
|
||||
" does not have a declaration for this field\'s default of " +
|
||||
field->value.constant);
|
||||
|
||||
Reference in New Issue
Block a user