We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d8e0b0d commit 613d2c3Copy full SHA for 613d2c3
clang/lib/AST/Interp/Pointer.cpp
@@ -149,6 +149,10 @@ APValue Pointer::toAPValue(const ASTContext &ASTCtx) const {
149
CharUnits Offset = CharUnits::Zero();
150
151
auto getFieldOffset = [&](const FieldDecl *FD) -> CharUnits {
152
+ // This shouldn't happen, but if it does, don't crash inside
153
+ // getASTRecordLayout.
154
+ if (FD->getParent()->isInvalidDecl())
155
+ return CharUnits::Zero();
156
const ASTRecordLayout &Layout = ASTCtx.getASTRecordLayout(FD->getParent());
157
unsigned FieldIndex = FD->getFieldIndex();
158
return ASTCtx.toCharUnitsFromBits(Layout.getFieldOffset(FieldIndex));
0 commit comments