diff options
author | Steve Naroff <snaroff@apple.com> | 2008-05-31 23:10:15 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-05-31 23:10:15 +0000 |
commit | 09efde0ae70bef8a65d881369831c76f702cda90 (patch) | |
tree | 4b11139bae7894cfd9d8ef08652f1e9c3aa763ff /clang/test/Sema/conditional-expr.m | |
parent | a834b52256b6084322b1b08fcf55b90a4997495e (diff) | |
download | bcm5719-llvm-09efde0ae70bef8a65d881369831c76f702cda90.tar.gz bcm5719-llvm-09efde0ae70bef8a65d881369831c76f702cda90.zip |
Add some more test cases that demonstrate clang is a bit stricter than GCC. These can be fixed lazily if they become a problem.
llvm-svn: 51830
Diffstat (limited to 'clang/test/Sema/conditional-expr.m')
-rw-r--r-- | clang/test/Sema/conditional-expr.m | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/Sema/conditional-expr.m b/clang/test/Sema/conditional-expr.m index d2620416fd3..e3cd041d3a5 100644 --- a/clang/test/Sema/conditional-expr.m +++ b/clang/test/Sema/conditional-expr.m @@ -19,3 +19,26 @@ return self; } @end + +@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. + self = nextOutputStream; // expected-error {{incompatible type assigning 'id<DTOutputStreams>', expected 'DTFilterOutputStream2 *'}} + return nextOutputStream ? nextOutputStream : self; // expected-error {{incompatible operand types ('id<DTOutputStreams>' and 'DTFilterOutputStream2 *')}} +} +@end + +// No @interface declaration for DTFilterOutputStream3 +@implementation DTFilterOutputStream3 // expected-warning {{cannot find interface declaration for 'DTFilterOutputStream3'}} +- (id)initWithNextOutputStream:(id <DTOutputStreams>) outputStream { + id <DTOutputStreams> nextOutputStream = [self nextOutputStream]; + // GCC warns about both of these as well (no errors). + self = nextOutputStream; // expected-error {{incompatible type assigning 'id<DTOutputStreams>', expected 'DTFilterOutputStream3 *'}} + return nextOutputStream ? nextOutputStream : self; // expected-error {{incompatible operand types ('id<DTOutputStreams>' and 'DTFilterOutputStream3 *')}} +} +@end |