mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
Schema parser: prohibit declaration of an array of pointers inside structs (#5907)
* Fix issue #5906, Prohibit declaration of an array of pointers inside structs - idl_parser.cpp: Prohibit declaration of an array of pointers inside structs - idl_gen_cpp.cpp: Extract GenStructConstructor() method from GenStruct() to simplify future modification - idl_gen_cpp.cpp: Add assert for checking of Array fields in structs on code-generation stage * Fix the error 'unused local variable' in release build * Fix: format the PR code according to coding rules * Add test-case and fix review notes
This commit is contained in:
@@ -1623,6 +1623,9 @@ void ErrorTest() {
|
||||
TestError("table X { Y:int; } root_type X; { Y:1.0 }", "float");
|
||||
TestError("table X { Y:bool; } root_type X; { Y:1.0 }", "float");
|
||||
TestError("enum X:bool { Y = true }", "must be integral");
|
||||
// Array of non-scalar
|
||||
TestError("table X { x:int; } struct Y { y:[X:2]; }",
|
||||
"may contain only scalar or struct fields");
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
Reference in New Issue
Block a user