aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-01-26 01:26:44 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-01-26 01:26:44 +0000
commita4356adfd4a79bd63f86e2b30878795ce7b9b0a6 (patch)
tree20fc80c9663e9989d0cc2224bd8d74d3062823f9 /lib
parent4717f163eb3578f5bada399dd6ced1c62847bfe4 (diff)
Correct r124242 making sure function chunk that gets diagnosed is really about the block.
Clairvoyance by John! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124264 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaType.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 2a54bcc3af..8ca1e00823 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -1622,7 +1622,10 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
if ((T->isArrayType() || T->isFunctionType()) &&
(D.getName().getKind() != UnqualifiedId::IK_ConversionFunctionId)) {
unsigned diagID = diag::err_func_returning_array_function;
- if (D.getContext() == Declarator::BlockLiteralContext)
+ // Last processing chunk in block context means this function chunk
+ // represents the block.
+ if (chunkIndex == 0 &&
+ D.getContext() == Declarator::BlockLiteralContext)
diagID = diag::err_block_returning_array_function;
Diag(DeclType.Loc, diagID) << T->isFunctionType() << T;
T = Context.IntTy;