[Bug c/65455] typeof _Atomic fails
joseph at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Tue Mar 17 22:02:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65455
--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Tue, 17 Mar 2015, jens.gustedt at inria dot fr wrote:
> Eliminating qualifiers in expressions is easy for arithmetic types at least,
> something like
>
> __typeof__((a)+0) b;
No, that would not work for the uses in stdatomic.h. The temporary must
have the unqualified, non-atomic type when a is, for example, _Atomic
char; there can't be any promotions as otherwise the type would be wrong
when the address of the temporary is taken.
> (and BTW, the current version of stdatomic.h uses __auto_type, which makes it
> incompatible with clang.)
Well, GCC's stdatomic.h only ever needs to be compatible with the same
version of GCC it ships with. __auto_type is to avoid duplicate
evaluations of side-effects in operands with variably modified types (a
variably modified argument to typeof is evaluated, unlike a non-VM
argument); see gcc.dg/atomic/stdatomic-vm.c.
More information about the Gcc-bugs
mailing list