bool HasMutableFields : 1;
/// \brief True if there no non-field members declared by the user.
- bool HasOnlyFields : 1;
+ bool HasOnlyCMembers : 1;
/// HasTrivialDefaultConstructor - True when, if this class has a default
/// constructor, this default constructor is trivial.
Aggregate(true), PlainOldData(true), Empty(true), Polymorphic(false),
Abstract(false), IsStandardLayout(true), HasNoNonEmptyBases(true),
HasPrivateFields(false), HasProtectedFields(false), HasPublicFields(false),
- HasMutableFields(false), HasOnlyFields(true),
+ HasMutableFields(false), HasOnlyCMembers(true),
HasTrivialDefaultConstructor(true),
HasConstexprNonCopyMoveConstructor(false),
DefaultedDefaultConstructorIsConstexpr(true),
}
void CXXRecordDecl::addedMember(Decl *D) {
- if (!isa<FieldDecl>(D) && !isa<IndirectFieldDecl>(D) && !D->isImplicit())
- data().HasOnlyFields = false;
+ if (!D->isImplicit() &&
+ !isa<FieldDecl>(D) &&
+ !isa<IndirectFieldDecl>(D) &&
+ (!isa<TagDecl>(D) || cast<TagDecl>(D)->getTagKind() == TTK_Class))
+ data().HasOnlyCMembers = false;
// Ignore friends and invalid declarations.
if (D->getFriendObjectKind() || D->isInvalidDecl())
return true;
return isPOD() &&
- data().HasOnlyFields &&
+ data().HasOnlyCMembers &&
!data().HasPrivateFields &&
!data().HasProtectedFields &&
!data().NumBases;