"method %objcinstance0 not found in protocol (return type defaults to 'id')")
DIAG(error_bad_receiver_type, ERROR,
"bad receiver type %0")
-DIAG(warn_objc_throw_expects_object, WARNING,
+DIAG(error_objc_throw_expects_object, ERROR,
"invalid %0 argument (expected an ObjC object type)")
DIAG(error_rethrow_used_outside_catch, ERROR,
"@throw (rethrow) used outside of a @catch block")
}
Action::OwningStmtResult
-Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, ExprArg expr,
- Scope *CurScope) {
+Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, ExprArg expr,Scope *CurScope) {
Expr *ThrowExpr = static_cast<Expr*>(expr.release());
if (!ThrowExpr) {
// @throw without an expression designates a rethrow (which much occur
if (!Context.isObjCObjectPointerType(ThrowType)) {
const PointerType *PT = ThrowType->getAsPointerType();
if (!PT || !PT->getPointeeType()->isVoidType())
- // This should be an error, however GCC only yields a warning.
- Diag(AtLoc, diag::warn_objc_throw_expects_object)
+ Diag(AtLoc, diag::error_objc_throw_expects_object)
<< ThrowExpr->getType() << ThrowExpr->getSourceRange();
}
}
return proc();
}
@catch (Frob* ex) {
- @throw 1,2; // expected-warning {{invalid 'int' argument (expected an ObjC object type)}}
+ @throw 1,2; // expected-error {{invalid 'int' argument (expected an ObjC object type)}}
}
@catch(...) {
@throw (4,3,proc());
@end
int foo() {
- @throw 42; // expected-warning {{invalid 'int' argument (expected an ObjC object type)}}
+ struct s { int a, b; } agg, *pagg;
+
+ @throw 42; // expected-error {{invalid 'int' argument (expected an ObjC object type)}}
+ @throw agg; // expected-error {{invalid 'struct s' argument (expected an ObjC object type)}}
+ @throw pagg; // expected-error {{invalid 'struct s *' argument (expected an ObjC object type)}}
@throw; // expected-error {{@throw (rethrow) used outside of a @catch block}}
}