2008-06-01 06:33:45 +08:00
|
|
|
// RUN: clang -fsyntax-only -verify -pedantic %s
|
|
|
|
@protocol NSObject
|
|
|
|
@end
|
|
|
|
|
|
|
|
@protocol DTOutputStreams <NSObject>
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface DTFilterOutputStream <DTOutputStreams>
|
|
|
|
- nextOutputStream;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation DTFilterOutputStream
|
|
|
|
- (id)initWithNextOutputStream:(id <DTOutputStreams>) outputStream {
|
|
|
|
id <DTOutputStreams> nextOutputStream = [self nextOutputStream];
|
|
|
|
self = nextOutputStream;
|
|
|
|
return nextOutputStream ? nextOutputStream : self;
|
|
|
|
}
|
|
|
|
- nextOutputStream {
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
@end
|
2008-06-01 07:10:15 +08:00
|
|
|
|
|
|
|
@interface DTFilterOutputStream2
|
|
|
|
- nextOutputStream;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation DTFilterOutputStream2 // expected-warning {{incomplete implementation}} expected-warning {{method definition for 'nextOutputStream' not found}}
|
|
|
|
- (id)initWithNextOutputStream:(id <DTOutputStreams>) outputStream {
|
|
|
|
id <DTOutputStreams> nextOutputStream = [self nextOutputStream];
|
|
|
|
// GCC warns about both of these.
|
2008-10-15 06:18:38 +08:00
|
|
|
self = nextOutputStream; // expected-warning {{incompatible type assigning 'id<DTOutputStreams>', expected 'DTFilterOutputStream2 *'}}
|
2008-09-04 01:53:25 +08:00
|
|
|
return nextOutputStream ? nextOutputStream : self;
|
2008-06-01 07:10:15 +08:00
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
// No @interface declaration for DTFilterOutputStream3
|
|
|
|
@implementation DTFilterOutputStream3 // expected-warning {{cannot find interface declaration for 'DTFilterOutputStream3'}}
|
|
|
|
- (id)initWithNextOutputStream:(id <DTOutputStreams>) outputStream {
|
2009-03-04 06:19:15 +08:00
|
|
|
id <DTOutputStreams> nextOutputStream = [self nextOutputStream]; // expected-warning {{DTFilterOutputStream3 may not respond to 'nextOutputStream'}}
|
2008-06-01 07:10:15 +08:00
|
|
|
// GCC warns about both of these as well (no errors).
|
2008-10-15 06:18:38 +08:00
|
|
|
self = nextOutputStream; // expected-warning {{incompatible type assigning 'id<DTOutputStreams>', expected 'DTFilterOutputStream3 *'}}
|
2008-09-04 01:53:25 +08:00
|
|
|
return nextOutputStream ? nextOutputStream : self;
|
2008-06-01 07:10:15 +08:00
|
|
|
}
|
|
|
|
@end
|