[PATCH] D152003: [clang] Fix `static_cast` to array of unknown bound
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 2 08:32:39 PDT 2023
erichkeane 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();
----------------
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()`.
================
Comment at: clang/lib/Sema/SemaType.cpp:8826
+ const Type *InnerType = SubInit->getType().getTypePtr();
+ if (const auto *AT = dyn_cast<ConstantArrayType>(InnerType);
+ AT && AT->getSize() == 1) {
----------------
Not supposed to have curleys here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152003/new/
https://reviews.llvm.org/D152003
More information about the cfe-commits
mailing list