[clang] [C23] Fix typeof handling in enum declarations (PR #146394)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 3 04:45:10 PDT 2025


AaronBallman wrote:

> > > ```c++
> > > typeof(int){} x; // Probably parsed as typeof(int{})
> > > ```
> > 
> > 
> > Actually, I’m not sure what we think this is supposed to be; I haven’t checked.
> 
> Actually, that’s just a compound literal; I forgot we supported those in C++.

It's a reallllly funky compound literal though, so worth explaining for others:

That's `(int){}` as a compound literal expression, which is the expression operand to an unparenthesized `typeof` operator, which yields the type `int` for the declaration of `x`.

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


More information about the cfe-commits mailing list