/* Check that instance methods in root classes are searched when sending messages to class objects. */ /* Contributed by Alexander Malmberg */ /* { dg-do compile } */ #include @protocol Quux -(void) protocolInstanceMethod; +(void) protocolClassMethod; @end @protocol Baz -(void) rootProtocolInstanceMethod; @end @interface Foo +(void) classMethod; -(void) rootInstanceMethod; @end @interface Foo (aCategory) -(void) rootCategoryInstanceMethod; @end @interface Bar : Foo -(void) instanceMethod; @end Class c; void foo(void) { [c classMethod]; [c instanceMethod]; /* { dg-warning "no prototype found for .\\+instanceMethod." } */ /* { dg-warning "\\(Messages without a matching method prototype" "" { target *-*-* } 35 } */ /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 35 } */ /* { dg-warning ".\.\.\.. as arguments\.\\)" "" { target *-*-* } 35 } */ [c rootInstanceMethod]; [c rootCategoryInstanceMethod]; /* { dg-warning "no prototype found for .\\+rootCategoryInstanceMethod." } */ [c protocolClassMethod]; [c protocolInstanceMethod]; /* { dg-warning "no prototype found for .\\+protocolInstanceMethod." } */ [c rootProtocolInstanceMethod]; /* { dg-warning "no prototype found for .\\+rootProtocolInstanceMethod." } */ }