Fznamznon added inline comments.

================
Comment at: clang/lib/Sema/SemaType.cpp:8824
+  if (auto *Cast = dyn_cast<CXXStaticCastExpr>(E)) {
+    if (auto *SubInit = dyn_cast<CXXParenListInitExpr>(Cast->getSubExpr())) {
+      const Type *InnerType = SubInit->getType().getTypePtr();
----------------
erichkeane wrote:
> I am not really sure this is the right way about this.  You're supposed to be 
> testing `T`, but this looks like it is checking the type of `E`, isn't it?  I 
> think you just need to check `Cast->getType()`.
For the case I'm trying to fix, `T` is array of unknown bound, it is already 
checked before calling `completeExprArrayBound`. Right now when you write 
something like
```
int (&&arr1)[1] = static_cast<int[]>(42);
```
Clang actually is able to realize that parenthesized initialization is made, so 
it actually generates `CXXParenListInitExpr` that has type int[1]. Here I'm 
just paranoidally double-checking that is the case before switching the type. 
Maybe I don't need this double-check at all then?



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152003

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

Reply via email to