Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang with c++2a: 'no_destroy' attribute cannot be applied to types #8297

Closed
mumbleskates opened this issue Feb 14, 2021 · 1 comment
Closed

Comments

@mumbleskates
Copy link
Contributor

What version of protobuf and what language are you using?
Version: master, first appearing in commit a001250
Language: C++

What operating system (Linux, Windows, ...) and version?
linux (ubuntu 20.10)

What runtime / compiler are you using (e.g., python version or gcc version)
clang 11.0.0-2 in C++2a standard

What did you do?
Steps to reproduce the behavior:

  1. CC=clang bazel build --cxxopt='-std=c++2a' //:protobuf
  2. observe error: 'no_destroy' attribute cannot be applied to types in basically any generated pb source file (and some non-generated ones)

What did you expect to see
No errors, hopefully. It would be nice. It worked up until now.

What did you see instead?
Compilation failures. One possible result:

src/google/protobuf/duration.pb.cc:32:20: error: 'no_destroy' attribute cannot be applied to types
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_NO_DESTROY DurationDefaultTypeInternal _Duration_default_instance_;
                   ^
src/google/protobuf/port_def.inc:592:41: note: expanded from macro 'PROTOBUF_ATTRIBUTE_NO_DESTROY'
#define PROTOBUF_ATTRIBUTE_NO_DESTROY [[clang::no_destroy]]
                                        ^

Anything else we should know about your project / environment
Nothing that comes to mind. It's unclear what the problem is here exactly, whether this is misbehavior by LLVM or a mistake in the protobuf library; from what I can tell based on the documentation this does look like the right way to use the annotation.

@mumbleskates
Copy link
Contributor Author

Oh fantastic, since I went to sleep @Yuhanun opened #8296 with the right answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant