[clang] [analyzer] Make it a noop when initializing a field of empty record (PR #138594)
via cfe-commits
cfe-commits at lists.llvm.org
Wed May 7 12:48:24 PDT 2025
================
@@ -715,7 +716,11 @@ void ExprEngine::handleConstructor(const Expr *E,
// actually make things worse. Placement new makes this tricky as well,
// since it's then possible to be initializing one part of a multi-
// dimensional array.
- State = State->bindDefaultZero(Target, LCtx);
+ const CXXRecordDecl *TargetHeldRecord =
+ cast<CXXRecordDecl>(CE->getType()->getAsRecordDecl());
----------------
isuckatcs wrote:
This cast can actually fail. See the broken testcase:
```
llvm-project/llvm/include/llvm/Support/Casting.h:109: static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = clang::CXXRecordDecl; From = clang::RecordDecl]: Assertion `Val && "isa<> used on a null pointer"' failed.
```
https://github.com/llvm/llvm-project/pull/138594
More information about the cfe-commits
mailing list