Skip to content

shadowed field _cached_size_ ? #9378

@0x8000-0000

Description

@0x8000-0000

What version of protobuf and what language are you using?
Version: v3.19.1
Language: C++

What operating system (Linux, Windows, ...) and version?
Ubuntu 20.04

What runtime / compiler are you using (e.g., python version or gcc version)
GCC11 and Clang13

What did you do?
Generated a simple message and tried to compile it with our toolchain and default warnings.

What did you expect to see
No warning / no error.

What did you see instead?
Member ZeroFieldsBase::cached_size is shadowed in derived classes.

For example: src/google/protobuf/empty.pb.h defines class Empty, extending ZeroFieldsBase and defining cached_size yet again.

The field in the base class is defined as

 mutable internal::CachedSize _cached_size_;

while the field in the derived classes is defined as:

  mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Is this shadowing intentional? Can the field in the ZeroFieldsBase be renamed to avoid it?

Metadata

Metadata

Assignees

Labels

c++inactiveDenotes the issue/PR has not seen activity in the last 90 days.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions