protoc generates faulty C++ code for nested message 'New'
What version of protobuf and what language are you using? Version: 3.6.1 -- 23.3 Language: C++
What operating system (Linux, Windows, ...) and version? Ubuntu 20.04 Debian 11
What runtime / compiler are you using (e.g., python version or gcc version) gcc 9.4.0 -- 12.3.0
What did you do?
I tried to compile google/apps/drive/activity/v2/action.proto from googleapis for C++.
Here is a minimal failing example:
- Create file
test.protosyntax = "proto3"; message Foo { message New {} } - Run
$ protoc test.proto --cpp_out=. $ g++ -c test.pb.cc In file included from test.pb.cc:4: test.pb.h:304:19: error: ‘typedef class Foo_New Foo::New’ conflicts with a previous declaration 304 | typedef Foo_New New; | ^~~ test.pb.h:261:8: note: previous declaration ‘Foo::New’ 261 | Foo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { |
What did you expect to see No error.
What did you see instead? The error.
Let me see if we have an easy list of things we mangle off to fix this with...
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive because the last activity was over 90 days ago.
Commenting as requested that this is still an issue.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive because the last activity was over 90 days ago.
Commenting as requested that this is still an issue.
Sorry, I don't have time to run this one down.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive because the last activity was over 90 days ago.
Commenting as requested (by the triage bot) that this is still an issue.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive because the last activity was over 90 days ago. This issue will be closed and archived after 14 additional days without activity.
Commenting as requested (by the triage bot) that this is still an issue.