diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -4794,6 +4794,11 @@ Result = APValue((const FieldDecl *)nullptr); return true; } + // Can't access properties of an incomplete type. + if (!RD->hasDefinition()) { + Result = APValue(); + return false; + } Result = APValue(APValue::UninitStruct(), RD->getNumBases(), std::distance(RD->field_begin(), RD->field_end()));