File tree Expand file tree Collapse file tree 2 files changed +2
-1
lines changed Expand file tree Collapse file tree 2 files changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -670,11 +670,11 @@ CheckedError Parser::ParseField(StructDef &struct_def) {
670
670
671
671
if (token_ == ' =' ) {
672
672
NEXT ();
673
+ ECHECK (ParseSingleValue (&field->name , field->value , true ));
673
674
if (!IsScalar (type.base_type ) ||
674
675
(struct_def.fixed && field->value .constant != " 0" ))
675
676
return Error (
676
677
" default values currently only supported for scalars in tables" );
677
- ECHECK (ParseSingleValue (&field->name , field->value , true ));
678
678
}
679
679
if (type.enum_def &&
680
680
!type.enum_def ->is_union &&
Original file line number Diff line number Diff line change @@ -1275,6 +1275,7 @@ void ErrorTest() {
1275
1275
TestError (" table Y {} table X { Y:int; }" , " same as table" );
1276
1276
TestError (" struct X { Y:string; }" , " only scalar" );
1277
1277
TestError (" table X { Y:string = \"\" ; }" , " default values" );
1278
+ TestError (" struct X { a:uint = 42; }" , " default values" );
1278
1279
TestError (" enum Y:byte { Z = 1 } table X { y:Y; }" , " not part of enum" );
1279
1280
TestError (" struct X { Y:int (deprecated); }" , " deprecate" );
1280
1281
TestError (" union Z { X } table X { Y:Z; } root_type X; { Y: {}, A:1 }" ,
You can’t perform that action at this time.
0 commit comments