[Bug c/65455] typeof _Atomic fails

jens.gustedt at inria dot fr gcc-bugzilla@gcc.gnu.org
Thu Mar 19 07:31:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65455

--- Comment #11 from Jens Gustedt <jens.gustedt at inria dot fr> ---
(In reply to joseph@codesourcery.com from comment #10)
> On Wed, 18 Mar 2015, jens.gustedt at inria dot fr wrote:
> 
> > (Perhaps gcc interprets _Generic as you say, but even the standard committee
> > doesn't agree on that interpretation, and other compiler implementors don't
> > agree either. Nothing in the standard says that it is an rvalue, nor that it
> > has to undergo any conversion. Conversion for non-evaluated expressions simply
> > doesn't exist in the standard. The standard explicitly asks for compatible type
> > of the expression itself, it says nothing about unqualified type.)
> 
> There isn't yet a conclusion to DR#423, but the committee discussion in 
> N1892 says 'Specifically, the controlling expression of a generic 
> selection "was very carefully not added" to the list of cases where lvalue 
> conversion is not done.' (i.e. that conversion happens to all expressions 
> unless excluded from happening).  There is no indication of a committee 
> direction contradicting the approach I chose for GCC (even if the 
> committee isn't quite sure of how to handle atomics there, and has 
> suggested making qualifiers on function return types not part of the 
> type).

And now we are exactly in the situation that I was afraid of happening,
compiler implementors interpret _Generic differently. Your interpretation and
the one that clang applies differ and make it that code with _Generic isn't
portable. That is just a disaster for an early (well not so early anymore)
adoption of C11.



More information about the Gcc-bugs mailing list