Index: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp @@ -285,6 +285,9 @@ void ProTypeMemberInitCheck::check(const MatchFinder::MatchResult &Result) { if (const auto *Ctor = Result.Nodes.getNodeAs("ctor")) { + // Skip declarations delayed by late template parsing without a body. + if (!Ctor->getBody()) + return; checkMissingMemberInitializer(*Result.Context, Ctor); checkMissingBaseClassInitializer(*Result.Context, Ctor); } else if (const auto *Var = Result.Nodes.getNodeAs("var")) { @@ -304,11 +307,6 @@ if (IsUnion && ClassDecl->hasInClassInitializer()) return; - // Skip declarations delayed by late template parsing without a body. - const Stmt *Body = Ctor->getBody(); - if (!Body) - return; - SmallPtrSet FieldsToInit; fieldsRequiringInit(ClassDecl->fields(), Context, FieldsToInit); if (FieldsToInit.empty()) @@ -323,7 +321,7 @@ FieldsToInit.erase(Init->getMember()); } } - removeFieldsInitializedInBody(*Body, Context, FieldsToInit); + removeFieldsInitializedInBody(*Ctor->getBody(), Context, FieldsToInit); // Collect all fields in order, both direct fields and indirect fields from // anonmyous record types. Index: clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp +++ clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp @@ -331,3 +331,10 @@ int X; // CHECK-FIXES: int X{}; }; + +// This check results in a CXXConstructorDecl with no body. +struct NegativeDeletedConstructor : NegativeAggregateType { + NegativeDeletedConstructor() = delete; + + Template F; +};