[clang] [C23] Fix typeof handling in enum declarations (PR #146394)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 3 07:12:15 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`.
Nope, I'm wrong.
`typeof` requires the parens. That should be ill-formed.
I'll investigate.
https://github.com/llvm/llvm-project/pull/146394
More information about the cfe-commits
mailing list