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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits