Details
-
Task
-
Resolution: Fixed
-
P1: Critical
-
6.5, 6.6, dev
-
None
-
b089a773e (dev)
Description
Current implementation doesn't allow forward declaration the nested enumerations. This leads to the issue when we want to use the following protobuf construction, that is legal from protobuf syntax point of view:
message A { enum AEnum { AVal0 = 0; AVal1 = 1; } B.BEnum val = 1; } message B { enum BEnum { BVal0 = 0; BVal1 = 1; } A.AEnum val = 1; }
The resulting code refelects the .proto structure and as the result A::val accesses the inclomplete type:
error: invalid use of incomplete type ‘class qtprotobufnamespace::tests::B’ <num> | B::BEnum val() const;
To support this, we should make the same trick that we already made for netsted messages - put all enumerations to the nested namespaces, but not nest them into containing messages.
This is major refactoring that breaks compatibility and has impact on meta-object model that will be generated.
We need to make sure that all enums are still accessible from both C++ and QML code using the message-based qualifiers.
Global or package enums use the similar concept so we should follow it.