diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-01-13 02:14:39 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-01-13 02:14:39 +0000 |
commit | f037541d5c7dcf3553cf26e4b047be869980c23a (patch) | |
tree | 42a279788b28adbd1cf9b0ef10cdb7af116f134d /lib/Sema/SemaFixItUtils.cpp | |
parent | 2f4d88f4418afafbd0b22ce0f79cdead6f3a6f99 (diff) |
Don't crash while trying to diagnose a function declared at block scope with an
incomplete return type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148088 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaFixItUtils.cpp')
-rw-r--r-- | lib/Sema/SemaFixItUtils.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaFixItUtils.cpp b/lib/Sema/SemaFixItUtils.cpp index 1f17a9e83e..0f7530b415 100644 --- a/lib/Sema/SemaFixItUtils.cpp +++ b/lib/Sema/SemaFixItUtils.cpp @@ -180,9 +180,11 @@ const char *Sema::getFixItZeroInitializerForType(QualType T) const { if (T->isScalarType()) return " = 0"; const CXXRecordDecl *RD = T->getAsCXXRecordDecl(); - if (LangOpts.CPlusPlus0x && RD && !RD->hasUserProvidedDefaultConstructor()) + if (!RD || !RD->hasDefinition()) + return 0; + if (LangOpts.CPlusPlus0x && !RD->hasUserProvidedDefaultConstructor()) return "{}"; - if (T->isAggregateType()) + if (RD->isAggregate()) return " = {}"; return 0; } |