Disallow defaults on structs.
Change-Id: Ia098126c92ea6f8abe94561bd9c09b29ac8f61f5 Context: https://github.com/google/flatbuffers/issues/4591 Tested: on Linux.
This commit is contained in:
parent
2265129e14
commit
3694ae0817
|
@ -648,8 +648,9 @@ CheckedError Parser::ParseField(StructDef &struct_def) {
|
|||
|
||||
if (token_ == '=') {
|
||||
NEXT();
|
||||
if (!IsScalar(type.base_type))
|
||||
return Error("default values currently only supported for scalars");
|
||||
if (!IsScalar(type.base_type) || struct_def.fixed)
|
||||
return Error(
|
||||
"default values currently only supported for scalars in tables");
|
||||
ECHECK(ParseSingleValue(field->value));
|
||||
}
|
||||
if (IsFloat(field->value.type.base_type)) {
|
||||
|
|
Loading…
Reference in New Issue