[clang] [Clang][Sema] Reject array prvalue operands (PR #140702)

via cfe-commits cfe-commits at lists.llvm.org
Tue May 20 09:08:03 PDT 2025


languagelawyer wrote:

> That probably should continue to work -- we accept it today and so does GCC

GCC started accepting it from version 14, likely when fixing https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94264 (it is mentioned in https://github.com/llvm/llvm-project/issues/54016#issuecomment-1752262953), but it also started accepting `IA{ 1, 2, 3 } + 0`, which is clearly wrong https://godbolt.org/z/r7Yc3o1qd @pinskia @jicama

I think, if someone wants 100% C compatibility, then they should make compound literals lvalues. If compound literals are prvalues in C++ extension, then they should be treated like other array prvalues

https://github.com/llvm/llvm-project/pull/140702


More information about the cfe-commits mailing list