``` struct __attribute__((visibility("default"))) [[deprecated("a message")]] A1 { }; struct __attribute__((__deprecated__("a message"))) __attribute__((visibility("default"))) A2 { }; ``` A EXPORT macro containing a GCC-style visibility attribute (generated by CMake) and another macro containing a c++11-style macro can not be used to decorate a class. https://godbolt.org/z/qHxr6s
This one works too of course, but isn't helpful if you don't control the macros: struct [[gnu::visibility("default")]] [[deprecated("a message")]] A3 { };
Here is one where GCC works but clang does not: __attribute__((visibility("default"))) [[deprecated("a message")]] __attribute__((visibility("default"))) int A(void); If you remove the first __attribute__, clang will work.
This seems to be fixed in the latest release https://godbolt.org/z/Kdsrs76PT https://developers.redhat.com/articles/2023/06/21/new-c-features-gcc-13#additional_updates
Dup of bug 69585. *** This bug has been marked as a duplicate of bug 69585 ***