mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 12:05:50 +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:
@@ -1295,7 +1295,7 @@ class CppGenerator : public BaseGenerator {
|
||||
std::string GetDefaultScalarValue(const FieldDef &field) {
|
||||
if (field.value.type.enum_def && IsScalar(field.value.type.base_type)) {
|
||||
auto ev = field.value.type.enum_def->ReverseLookup(
|
||||
static_cast<int>(StringToInt(field.value.constant.c_str())), false);
|
||||
StringToInt(field.value.constant.c_str()), false);
|
||||
if (ev) {
|
||||
return WrapInNameSpace(field.value.type.enum_def->defined_namespace,
|
||||
GetEnumValUse(*field.value.type.enum_def, *ev));
|
||||
|
||||
Reference in New Issue
Block a user