diff options
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 1b95f05c79..8b237c8a3c 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -4301,9 +4301,14 @@ bool Sema::RequireLiteralType(SourceLocation Loc, QualType T, const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl()); - // FIXME: Better diagnostic for incomplete class? - if (!RD->isCompleteDefinition()) + // A partially-defined class type can't be a literal type, because a literal + // class type must have a trivial destructor (which can't be checked until + // the class definition is complete). + if (!RD->isCompleteDefinition()) { + RequireCompleteType(Loc, ElemType, + PDiag(diag::note_non_literal_incomplete) << T); return true; + } // If the class has virtual base classes, then it's not an aggregate, and // cannot have any constexpr constructors or a trivial default constructor, |