From 09efde0ae70bef8a65d881369831c76f702cda90 Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Sat, 31 May 2008 23:10:15 +0000 Subject: 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 --- clang/test/Sema/conditional-expr.m | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'clang') 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 ) outputStream { + id nextOutputStream = [self nextOutputStream]; + // GCC warns about both of these. + self = nextOutputStream; // expected-error {{incompatible type assigning 'id', expected 'DTFilterOutputStream2 *'}} + return nextOutputStream ? nextOutputStream : self; // expected-error {{incompatible operand types ('id' and 'DTFilterOutputStream2 *')}} +} +@end + +// No @interface declaration for DTFilterOutputStream3 +@implementation DTFilterOutputStream3 // expected-warning {{cannot find interface declaration for 'DTFilterOutputStream3'}} +- (id)initWithNextOutputStream:(id ) outputStream { + id nextOutputStream = [self nextOutputStream]; + // GCC warns about both of these as well (no errors). + self = nextOutputStream; // expected-error {{incompatible type assigning 'id', expected 'DTFilterOutputStream3 *'}} + return nextOutputStream ? nextOutputStream : self; // expected-error {{incompatible operand types ('id' and 'DTFilterOutputStream3 *')}} +} +@end -- cgit v1.2.3