[clang] [Clang][Sema] Reject array prvalue operands (PR #140702)
via cfe-commits
cfe-commits at lists.llvm.org
Tue May 20 06:47:42 PDT 2025
languagelawyer wrote:
> Is this going to break behavior in C?
Array **prvalues** is C++11+ exclusive thing. Compound literals are lvalues in C https://port70.net/~nsz/c/c11/n1570.html#6.5.2.5p4
Anyway, here is a check:
```sh
$ build/bin/clang -fsyntax-only test.c
test.c:2:3: warning: expression result unused [-Wunused-value]
2 | *((int []){ 1, 2, 3});
| ^~~~~~~~~~~~~~~~~~~~~
test.c:3:24: warning: expression result unused [-Wunused-value]
3 | ((int []){ 1, 2, 3}) + 0;
| ~~~~~~~~~~~~~~~~~~~~ ^ ~
2 warnings generated.
```
https://github.com/llvm/llvm-project/pull/140702
More information about the cfe-commits
mailing list