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/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index d7a812c..3cadd52 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -678,9 +678,10 @@
// If this is the first return we've seen in the block, infer the type of
// the block from it.
if (CurBlock->ReturnType == 0) {
- if (RetValExp)
+ if (RetValExp) {
+ UsualUnaryConversions(RetValExp);
CurBlock->ReturnType = RetValExp->getType().getTypePtr();
- else
+ } else
CurBlock->ReturnType = Context.VoidTy.getTypePtr();
return new ReturnStmt(ReturnLoc, RetValExp);
}