Using [[may_alias]] in C23/C++23 on a union works in neither post-"union" position, or at the end of the definition

Jonathan Wakely
Tue Dec 6 20:36:46 GMT 2022

On Tue, 6 Dec 2022 at 20:32, Gavin Ray wrote:
> Ah got it, didn't know that (handy, will save me duplicating a bunch of attributes).
> Thanks Jonathan!

The Clang doc acually show all the forms that can be used for each attribute:

"GNU" means __attribute__((may_alias)) and the C++11 and C2x columns
show that [[gnu::may_alias]] is the right way to use it.

Clang-specific attributes use clang:: instead e.g.

More information about the Gcc mailing list