zygoloid wrote:

> Note that the AST for the expression `T{}` looks like:
> 
> ```
> // using T = int;
> CXXFunctionalCastExpr 'T':'int' functional cast to T <NoOp>
> `-InitListExpr 'T':'int'
> // using T = const int;
> CXXFunctionalCastExpr 'int' functional cast to T <NoOp>
> `-InitListExpr 'int'
> // using T = void;
> CXXFunctionalCastExpr 'void' functional cast to T <NoOp>
> `-InitListExpr 'void'
> // using T = const void;
> CXXFunctionalCastExpr 'void' functional cast to T <NoOp>
> `-InitListExpr 'void'
> ```
> 
> (Since the `InitListExpr` already has `void` before anything is done, the 
> type doesn't need to be adjusted)

Nonetheless, I think it'd be more reasonable to use `CK_ToVoid` here rather 
than `CK_NoOp`. The `void` type for the `InitListExpr` is just a placeholder 
and not meant to mean that it's a real expression of type `void`. (We really 
ought to use a better placeholder there, so we can print the type out as 
`<braced initializer list>` instead of as `void` in diagnostics.)

https://github.com/llvm/llvm-project/pull/78060
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to