[clang] [C11] Generic selection expressions and qualified rvalues (PR #96913)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 28 04:25:36 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 and that it has utility for cases like use with `typeof` (consider: `typeof(foo().i) x = 12;`, but that we really should update the way qualifiers work so we can clean up edge cases in the language (like if the structure contained an array, there's a special case to give the returned object temporary lifetime but that might make it an lvalue or it could be an rvalue, depending on how you squint). `_Generic` is the only case we could find where it's possible to get an rvalue that you then perform notional lvalue conversion on, so the plan is for me to write a paper to narrowly repair `_Generic` by specifying the type is decayed and qualifiers are stripped rather than leaning on lvalue conversion.
https://github.com/llvm/llvm-project/pull/96913
More information about the cfe-commits
mailing list