Sema::ActOnBlockReturnStmt(): Need to perform the UsualUnaryConversions on the return type.
Sema::CheckReturnStackAddr(): Make sure we skip over implicit casts.
Added some more test cases...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56254 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 00b469b..f870e26 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -716,7 +716,12 @@
       Diag(DR->getLocStart(), diag::warn_ret_stack_addr,
            DR->getDecl()->getIdentifier()->getName(),
            RetValExp->getSourceRange());
-           
+    
+    // Skip over implicit cast expressions when checking for block expressions.
+    if (ImplicitCastExpr *IcExpr = 
+          dyn_cast_or_null<ImplicitCastExpr>(RetValExp))
+      RetValExp = IcExpr->getSubExpr();
+
     if (BlockExpr *C = dyn_cast_or_null<BlockExpr>(RetValExp))
       Diag(C->getLocStart(), diag::err_ret_local_block,
            C->getSourceRange());