protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

protoc generates faulty C++ code for nested message 'New'

Open oreiche opened this issue 2 years ago • 10 comments

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:

  1. Create file test.proto
    syntax = "proto3";
    message Foo {
      message New {}
    }
    
  2. 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.

oreiche avatar Jun 15 '23 08:06 oreiche

Let me see if we have an easy list of things we mangle off to fix this with...

fowles avatar Jun 15 '23 18:06 fowles

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.

github-actions[bot] avatar Nov 09 '23 10:11 github-actions[bot]

Commenting as requested that this is still an issue.

oreiche avatar Nov 10 '23 14:11 oreiche

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.

github-actions[bot] avatar Feb 10 '24 10:02 github-actions[bot]

Commenting as requested that this is still an issue.

oreiche avatar Feb 10 '24 21:02 oreiche

Sorry, I don't have time to run this one down.

fowles avatar Feb 12 '24 22:02 fowles

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.

github-actions[bot] avatar May 13 '24 10:05 github-actions[bot]

Commenting as requested (by the triage bot) that this is still an issue.

oreiche avatar May 13 '24 12:05 oreiche

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.

github-actions[bot] avatar Aug 13 '24 10:08 github-actions[bot]

Commenting as requested (by the triage bot) that this is still an issue.

oreiche avatar Aug 22 '24 10:08 oreiche