-
Notifications
You must be signed in to change notification settings - Fork 16.1k
shadowed field _cached_size_ ? #9378
Description
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?