AaronBallman wrote: > > Is this going to break behavior in C? > > Array **prvalues** is C++11+ exclusive thing. Compound literals are lvalues > in C
Ah, good point, I wasn't remembering that C and C++ are different in how they handle compound literals. And you can return a pointer to an array in C, but that's still an lvalue. > Anyway, here is a check: > > ```shell > $ 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. > ``` Thank you! https://github.com/llvm/llvm-project/pull/140702 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits