-
Notifications
You must be signed in to change notification settings - Fork 15.9k
Description
In Nov 2020 protobuf reserved the namespace pb
for protobuf to move to in the future (
protobuf/src/google/protobuf/port.h
Lines 42 to 44 in bd9a710
// Protobuf intends to move into the pb:: namespace. | |
namespace protobuf_future_namespace_placeholder {} | |
namespace pb = ::protobuf_future_namespace_placeholder; |
pb
namespace and breaks our ability to upgrade. This seems to be quite a common pattern in the industry - there's over 10k examples on github alone - https://github.com/search?l=Protocol+Buffer&p=1&q=%22package+pb%22&type=Code .
If at all possible can we roll back that change? I suspect it has the potential to break a huge number of users beyond just us.
What version of protobuf and what language are you using?
Version: 3.15.0
Language: C++
What operating system (Linux, Windows, ...) and version?
OSX
What runtime / compiler are you using (e.g., python version or gcc version)
clang --version
Apple clang version 12.0.0 (clang-1200.0.32.28)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
What did you do?
Steps to reproduce the behavior:
Create file pb/people/models/people.proto
:
syntax = "proto3";
package pb.people.models;
message Person {
string name = 1;
int32 id = 2;
string email = 3;
}
protoc -I. --cpp_out=. pb/people/models/people.proto
clang -g -fwrapv -O3 -Wall -I. -I /usr/local/include/ -c pb/people/models/people.pb.cc -o a.o -std=c++11
What did you expect to see
No output, Code compiles
What did you see instead?
./pb/people/models/people.pb.h:57:11: error: redefinition of 'pb' as different kind of symbol
namespace pb {
^
../cytobuf/third_party/protobuf/src/google/protobuf/port.h:44:11: note: previous definition is here
namespace pb = ::protobuf_future_namespace_placeholder;
^
In file included from pb/people/models/people.pb.cc:4:
./pb/people/models/people.pb.h:70:18: error: no member named 'people' in namespace 'protobuf_future_namespace_placeholder'
template<> ::pb::people::models::Person* Arena::CreateMaybeMessage<::pb::people::models::Person>(Arena*);
~~~~~~^
./pb/people/models/people.pb.h:70:74: error: no member named 'people' in namespace 'protobuf_future_namespace_placeholder'
template<> ::pb::people::models::Person* Arena::CreateMaybeMessage<::pb::people::models::Person>(Arena*);
...
...
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
Anything else we should know about your project / environment