diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-03-21 16:45:13 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-03-21 16:45:13 +0000 |
commit | 4e648e4770d85febaf15ad8b7bad458bd7338ae2 (patch) | |
tree | 8c4cddabb3316314b3c580da2bc6db05e9ab10f6 /lib/Sema/SemaStmt.cpp | |
parent | 677a35b628c8a9f0cef9277dbb78e6e8509d13e4 (diff) |
Allow void blocks to return witn a void expression in
c-mode to match behavior with void functions in c. Issue
warning with -pedantic. // rdar://11069896
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153200 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index ef453f5c6a..333f6dd255 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -1886,8 +1886,13 @@ Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { !(getLangOpts().CPlusPlus && (RetValExp->isTypeDependent() || RetValExp->getType()->isVoidType()))) { - Diag(ReturnLoc, diag::err_return_block_has_expr); - RetValExp = 0; + if (!getLangOpts().CPlusPlus && + RetValExp->getType()->isVoidType()) + Diag(ReturnLoc, diag::ext_return_has_void_expr) << "" << 2; + else { + Diag(ReturnLoc, diag::err_return_block_has_expr); + RetValExp = 0; + } } } else if (!RetValExp) { return StmtError(Diag(ReturnLoc, diag::err_block_return_missing_expr)); |