diff options
author | Anders Carlsson <andersca@mac.com> | 2009-10-13 21:49:31 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-10-13 21:49:31 +0000 |
commit | 07d68f1f0760110d430c4b849abd49f12777f09c (patch) | |
tree | df6a620b88427c4934091fd8cedf0e6f110a0fe0 /lib/Sema/SemaExpr.cpp | |
parent | cd542a1d8f231f9c162df66598af13ae1c6f4f07 (diff) |
More return type checking.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84034 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 194317ce23..56dd670233 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1572,9 +1572,7 @@ Sema::ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, } // Determine the result type - QualType ResultTy - = FnDecl->getType()->getAs<FunctionType>()->getResultType(); - ResultTy = ResultTy.getNonReferenceType(); + QualType ResultTy = FnDecl->getResultType().getNonReferenceType(); // Build the actual expression node. Expr *FnExpr = new (Context) DeclRefExpr(FnDecl, FnDecl->getType(), @@ -1583,9 +1581,15 @@ Sema::ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, Input.release(); Args[0] = Arg; - return Owned(new (Context) CXXOperatorCallExpr(Context, OverOp, FnExpr, - Args, 2, ResultTy, - OpLoc)); + + ExprOwningPtr<CXXOperatorCallExpr> + TheCall(this, new (Context) CXXOperatorCallExpr(Context, OverOp, + FnExpr, Args, 2, + ResultTy, OpLoc)); + + if (CheckCallReturnType(FnDecl->getResultType(), OpLoc, TheCall.get(), + FnDecl)) + return ExprError(); } else { // We matched a built-in operator. Convert the arguments, then // break out so that we will build the appropriate built-in |