"multiple garbage collection attributes specified for type")
DIAG(err_catch_param_not_objc_type, ERROR,
"@catch parameter is not an Objective-C class type")
+DIAG(warn_ignoring_qualifiers_on_catch_parm, WARNING,
+ "ignoring qualifiers on @catch parameter")
// C++ casts
ParmVarDecl *PVD = static_cast<ParmVarDecl*>(Parm);
// PVD == 0 implies @catch(...).
- if (PVD && !Context.isObjCObjectPointerType(PVD->getType()))
- return StmtError(Diag(PVD->getLocation(),
- diag::err_catch_param_not_objc_type));
+ if (PVD) {
+ if (!Context.isObjCObjectPointerType(PVD->getType()))
+ return StmtError(Diag(PVD->getLocation(),
+ diag::err_catch_param_not_objc_type));
+ if (PVD->getType()->isObjCQualifiedIdType())
+ return StmtError(Diag(PVD->getLocation(),
+ diag::warn_ignoring_qualifiers_on_catch_parm));
+ }
ObjCAtCatchStmt *CS = new (Context) ObjCAtCatchStmt(AtLoc, RParen,
PVD, static_cast<Stmt*>(Body.release()), CatchList);
// RUN: clang -verify %s
+@protocol P;
+
void f() {
@try {
} @catch (void a) { // expected-error{{@catch parameter is not an Objective-C class type}}
} @catch (int) { // expected-error{{@catch parameter is not an Objective-C class type}}
} @catch (int *b) { // expected-error{{@catch parameter is not an Objective-C class type}}
+ } @catch (id <P> c) { // expected-warning{{ignoring qualifiers on @catch parameter}}
}
}