aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaChecking.cpp4
-rw-r--r--test/Sema/block-return.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 24eb8b1d5e..a63e044272 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -1254,9 +1254,7 @@ Sema::CheckReturnStackAddr(Expr *RetValExp, QualType lhsType,
<< DR->getDecl()->getDeclName() << RetValExp->getSourceRange();
// Skip over implicit cast expressions when checking for block expressions.
- if (ImplicitCastExpr *IcExpr =
- dyn_cast_or_null<ImplicitCastExpr>(RetValExp))
- RetValExp = IcExpr->getSubExpr();
+ RetValExp = RetValExp->IgnoreParenCasts();
if (BlockExpr *C = dyn_cast_or_null<BlockExpr>(RetValExp))
if (C->hasBlockDeclRefExprs())
diff --git a/test/Sema/block-return.c b/test/Sema/block-return.c
index 87f4040be9..96dde363de 100644
--- a/test/Sema/block-return.c
+++ b/test/Sema/block-return.c
@@ -91,6 +91,8 @@ bptr foo5(int j) {
if (j)
return ^{ ^{ i=0; }(); }; // expected-error {{returning block that lives on the local stack}}
return ^{ i=0; }; // expected-error {{returning block that lives on the local stack}}
+ return (^{ i=0; }); // expected-error {{returning block that lives on the local stack}}
+ return (void*)(^{ i=0; }); // expected-error {{returning block that lives on the local stack}}
}
int (*funcptr3[5])(long);