diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -2480,13 +2480,10 @@ if (const auto *RT = T->getAs()) { const RecordDecl *RD = RT->getDecl(); - if (RD->isInvalidDecl()) - return ABIAlign; - // When used as part of a typedef, or together with a 'packed' attribute, // the 'aligned' attribute can be used to decrease alignment. - if (TI.AlignIsRequired && - (T->getAs() != nullptr || RD->hasAttr())) + if ((TI.AlignIsRequired && T->getAs() != nullptr) || + RD->isInvalidDecl()) return ABIAlign; unsigned PreferredAlign = static_cast(