}
// 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(),
input.release();
- Expr *CE = new (Context) CXXOperatorCallExpr(Context, Op, FnExpr,
- &Input, 1, ResultTy, OpLoc);
- return MaybeBindToTemporary(CE);
+ ExprOwningPtr<CallExpr> TheCall(this,
+ new (Context) CXXOperatorCallExpr(Context, Op, FnExpr,
+ &Input, 1, ResultTy, OpLoc));
+
+ if (CheckCallReturnType(FnDecl->getResultType(), OpLoc, TheCall.get(),
+ FnDecl))
+ return ExprError();
+
+ return MaybeBindToTemporary(TheCall.release());
} else {
// We matched a built-in operator. Convert the arguments, then
// break out so that we will build the appropriate built-in
// RUN: clang-cc -fsyntax-only -verify %s
-struct A; // expected-note 6 {{forward declaration of 'struct A'}}
+struct A; // expected-note 8 {{forward declaration of 'struct A'}}
A f(); // expected-note {{note: 'f' declared here}}
A f(); // expected-note {{'f' declared here}}
A operator()(); // expected-note {{'operator()' declared here}}
operator A(); // expected-note {{'operator A' declared here}}
+ A operator!(); // expected-note 2 {{'operator!' declared here}}
};
void g() {
b.operator()(); // expected-error {{calling 'operator()' with incomplete return type 'struct A'}}
b.operator A(); // expected-error {{calling 'operator A' with incomplete return type 'struct A'}}
+ b.operator!(); // expected-error {{calling 'operator!' with incomplete return type 'struct A'}}
+
+ !b; // expected-error {{calling 'operator!' with incomplete return type 'struct A'}}
}