summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-04-25 23:23:48 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-04-25 23:23:48 +0000
commit6ca73133ca7bf41a7c13646f1c150051a62d75ed (patch)
tree8c6b210588559c692fca025b9f40352ba70a1732 /clang/lib/Sema
parentf333acd68601e057e0e93f739165837865c67544 (diff)
downloadbcm5719-llvm-6ca73133ca7bf41a7c13646f1c150051a62d75ed.tar.gz
bcm5719-llvm-6ca73133ca7bf41a7c13646f1c150051a62d75ed.zip
If a type is non-literal by virtue of being incomplete produce notes
explaining that. llvm-svn: 155598
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaType.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 1b95f05c79a..8b237c8a3ca 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/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,
OpenPOWER on IntegriCloud