"variable is not assignable (missing __block type specifier)")
DIAG(err_typecheck_call_not_function, ERROR,
"called object type %0 is not a function or function pointer")
+DIAG(err_call_incomplete_return, ERROR,
+ "return type of called function (%0) is incomplete")
+DIAG(err_call_incomplete_argument, ERROR,
+ "argument type %0 is incomplete")
DIAG(err_typecheck_call_too_few_args, ERROR,
"too few arguments to %select{function|block|method}0 call")
DIAG(err_typecheck_call_too_many_args, ERROR,
"variable is not assignable (missing __block type specifier)">;
def err_typecheck_call_not_function : Error<
"called object type %0 is not a function or function pointer">;
+def err_call_incomplete_return : Error<
+ "return type of called function (%0) is incomplete">;
+def err_call_incomplete_argument : Error<
+ "argument type %0 is incomplete">;
def err_typecheck_call_too_few_args : Error<
"too few arguments to %select{function|block|method}0 call">;
def err_typecheck_call_too_many_args : Error<
if (i < NumArgs) {
Arg = Args[i];
+ if (RequireCompleteType(Arg->getSourceRange().getBegin(),
+ ProtoArgType,
+ diag::err_call_incomplete_argument,
+ Arg->getSourceRange()))
+ return true;
+
// Pass the argument.
if (PerformCopyInitialization(Arg, ProtoArgType, "passing"))
return true;
return ExprError(Diag(LParenLoc, diag::err_typecheck_call_not_function)
<< Fn->getType() << Fn->getSourceRange());
+ // Check for a valid return type
+ if (!FuncT->getResultType()->isVoidType() &&
+ RequireCompleteType(Fn->getSourceRange().getBegin(),
+ FuncT->getResultType(),
+ diag::err_call_incomplete_return,
+ TheCall->getSourceRange()))
+ return ExprError();
+
// We know the result type of the call, set it.
TheCall->setType(FuncT->getResultType().getNonReferenceType());
for (unsigned i = 0; i != NumArgs; i++) {
Expr *Arg = Args[i];
DefaultArgumentPromotion(Arg);
+ if (RequireCompleteType(Arg->getSourceRange().getBegin(),
+ Arg->getType(),
+ diag::err_call_incomplete_argument,
+ Arg->getSourceRange()))
+ return ExprError();
TheCall->setArg(i, Arg);
}
}
/// PR3688
struct s1 {
- enum e1 (*bar)(void); // expected-error{{ISO C++ forbids forward references to 'enum' types}}
+ enum e1 (*bar)(void); // expected-error{{ISO C++ forbids forward references to 'enum' types}} expected-note{{forward declaration of 'enum s1::e1'}}
};
enum e1 { YES, NO };
static enum e1 badfunc(struct s1 *q) {
- return q->bar(); // expected-error{{incompatible type returning 'enum s1::e1', expected 'enum e1'}}
+ return q->bar(); // expected-error{{return type of called function ('enum s1::e1') is incomplete}}
}
enum e2; // expected-error{{ISO C++ forbids forward references to 'enum' types}}