[clang] [C11] Generic selection expressions and qualified rvalues (PR #96913)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 9 10:12:13 PDT 2024
AaronBallman wrote:
> > > Discussion on the WG14 reflectors suggested that the qualifiers should still be stripped from the type of the controlling expression; the standard should be corrected to make this more clear.
> >
> >
> > Does WG14 think we're right to produce a qualified rvalue in this case? Another option might be to strip qualifiers in rvalue member access, but that would have further-reaching impact.
>
> The sentiment on the reflector (granted, it's reflector sentiment and not asked of the whole committee in an official way) was that you do get a qualified rvalue out a member access expression
Now Joseph Myers has brought up the opposite:
>>Do you think GCC would be willing to break code
>> using __typeof__ so that __typeof__ and typeof behave the same in this
>> case? If so, I can check with the Clang community to see if there's an
>>
> I think it would be a reasonable change in GCC not to have qualifiers here
> for either typeof or __typeof__, much like a series of previous fixes in
> this area by Martin to avoid qualifiers on rvalues in other cases. The
> one case where we deliberately make C23 typeof behave differently from
> __typeof__ (any mode) and typeof in pre-C23 GNU modes is that __typeof__
> treats the noreturn property of a function as being part of its type.
So it's now less clear which direction to resolve this. I am thinking of putting up a question on Discourse to see whether the community would support changing `__typeof__` behavior to drop qualifiers in this case despite that being a potentially breaking change. If the community says we cannot/should not, then that's good information to bring back to WG14.
https://github.com/llvm/llvm-project/pull/96913
More information about the cfe-commits
mailing list