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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed May 21 04:23:52 PDT 2025


AaronBallman wrote:

> > it is CWG2548; that's what made it clear that array-to-pointer decay does not happen here
> 
> CWG2548 is closed as NAD, with no changes to the wording. 

Correct.

> The fact that array-to-pointer decay does not happen has always been clear

Incorrect; the reason the core issue was filed in the first place was because it seemed like an oversight that the language was inconsistent. Clang was implementing the consistent behavior where array to pointer decay happened. That's why this is CWG2548.

> > despite that being inconsistent with the rest of the language
> 
> I'd say CWG hallucinated inconsistence, to me there is none

```
int x[10];

(void)(x + 0); // perfectly fine, array to pointer decay on x
(void)((int[10]){} + 0); // Not okay under CWG2548 being closed NAD, no array to pointer decay on the temporary
```
So definitely inconsistent, and EWG agreed that it was, but liked the accidental behavior that came from it.

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


More information about the cfe-commits mailing list