From 19b87d28317f260192d91d723b80b079711d7356 Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Sat, 31 May 2008 23:10:15 +0000 Subject: [PATCH] Add some more test cases that demonstrate clang is a bit stricter than GCC. These can be fixed lazily if they become a problem. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51830 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Sema/conditional-expr.m | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/Sema/conditional-expr.m b/test/Sema/conditional-expr.m index d2620416fd..e3cd041d3a 100644 --- a/test/Sema/conditional-expr.m +++ b/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 -- 2.40.0