-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How could I solve enum conflict? #451
Comments
@hanke0, you must rename one or both of the enum values so they don't have the same name. Apologies if the error message is unclear. But it's saying that those enum value names are in the same lexical scope -- so the fully-qualified name for both elements is Also see this part of the spec: https://protobuf.com/docs/language-spec#fully-qualified-names |
Is there be an option that I can ignore this error and build successful?
|
@hanke0, the Protobuf source is invalid, and doesn't compile with enum Foo {
FOO_UNSPECIFIC = 0;
}
enum B {
B_UNSPECIFIC = 0;
} If you ignore this error, the Protobuf source won't compile elsewhere, and the compiled descriptors wouldn't be safe to generate code from. Besides C++, there may be other code generators that rely on this limitation to be enforced. So I don't think we want to provide an option to disable the limitation. It is possible that the limitation will be lifted in a future edition though, see this comment in descriptor.proto. |
It panics when I compile following proto file.
The message says that
panic: foo.proto:11:9: symbol "google.protobuf.UNSPECIFIC" already defined at foo.proto:7:9; protobuf uses C++ scoping rules for enum values, so they exist in the scope enclosing the enum
, how could I solve it?The text was updated successfully, but these errors were encountered: