Bug 96117 - Cannot mix c++11-style and GCC-style attributes on struct in one specific location
Summary: Cannot mix c++11-style and GCC-style attributes on struct in one specific loc...
Status: RESOLVED DUPLICATE of bug 69585
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2020-07-08 14:32 UTC by Stephen
Modified: 2023-06-23 20:33 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2020-07-08 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen 2020-07-08 14:32:08 UTC
```
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
Comment 1 Jonathan Wakely 2020-07-08 15:43:43 UTC
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 { };
Comment 2 Andrew Pinski 2021-12-20 11:58:01 UTC
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.
Comment 4 Andrew Pinski 2023-06-23 20:33:01 UTC
Dup of bug 69585.

*** This bug has been marked as a duplicate of bug 69585 ***