aaronpuchert added a comment.

In D98664#2628591 <https://reviews.llvm.org/D98664#2628591>, @aaron.ballman 
wrote:

> As far as the changes go, these seem reasonable to me, though I find it a bit 
> odd that these are expressions without a type whereas a `ParenExpr` has a 
> type of the underlying parenthesized expression. e.g.,
>
>   int x(0); // (0) has void type
>   int y = (0); // (0) has int type
>
> I think my natural assumption is that the init expression would have the type 
> of the thing that's being initialized.

In this case the `int` type will be assigned when the initialization is carried 
out in Sema. The `void` will only remain if we are in a template and the 
variable being initialized has a dependent type, so we can't carry out the 
initialization. Also if there are errors. It's similar to `int y{0};` in that 
regard.

If we don't know the type this syntax could be a constructor call, conversion 
operator call, but also regular value initialization. So we can't use 
`CXXUnresolvedConstructExpr` or something like that. That's my understanding.

> Despite that, I think the changes LG, but I'd like to hear from @rsmith.

So would I, also about whether to use the dependent type instead.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98664/new/

https://reviews.llvm.org/D98664

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to