Don't allow blocks to be declared as returning an array. Radar 6441502
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70277 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index f2f8ae5..045fa18 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -4726,6 +4726,12 @@
|| ParamInfo.getTypeObject(0).Kind != DeclaratorChunk::Function) {
QualType T = GetTypeForDeclarator(ParamInfo, CurScope);
+ if (T->isArrayType()) {
+ Diag(ParamInfo.getSourceRange().getBegin(),
+ diag::err_block_returns_array);
+ return;
+ }
+
// The parameter list is optional, if there was none, assume ().
if (!T->isFunctionType())
T = Context.getFunctionType(T, NULL, 0, 0, 0);