aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-01-13 02:14:39 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-01-13 02:14:39 +0000
commitf037541d5c7dcf3553cf26e4b047be869980c23a (patch)
tree42a279788b28adbd1cf9b0ef10cdb7af116f134d /lib/Sema/SemaDecl.cpp
parent2f4d88f4418afafbd0b22ce0f79cdead6f3a6f99 (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/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 4dcf1db2cf..20309ee51c 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -4945,7 +4945,8 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
// Empty parens mean value-initialization, and no parens mean default
// initialization. These are equivalent if the default constructor is
// user-provided, or if zero-initialization is a no-op.
- if (RD && (RD->isEmpty() || RD->hasUserProvidedDefaultConstructor()))
+ if (RD && RD->hasDefinition() &&
+ (RD->isEmpty() || RD->hasUserProvidedDefaultConstructor()))
Diag(C.Loc, diag::note_empty_parens_default_ctor)
<< FixItHint::CreateRemoval(ParenRange);
else if (const char *Init = getFixItZeroInitializerForType(T))