[cfe-commits] r51830 - /cfe/trunk/test/Sema/conditional-expr.m

Steve Naroff snaroff at apple.com
Sat May 31 16:10:15 PDT 2008


Author: snaroff
Date: Sat May 31 18:10:15 2008
New Revision: 51830

URL: http://llvm.org/viewvc/llvm-project?rev=51830&view=rev
Log:
Add some more test cases that demonstrate clang is a bit stricter than GCC. These can be fixed lazily if they become a problem.

Modified:
    cfe/trunk/test/Sema/conditional-expr.m

Modified: cfe/trunk/test/Sema/conditional-expr.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/conditional-expr.m?rev=51830&r1=51829&r2=51830&view=diff

==============================================================================
--- cfe/trunk/test/Sema/conditional-expr.m (original)
+++ cfe/trunk/test/Sema/conditional-expr.m Sat May 31 18:10:15 2008
@@ -19,3 +19,26 @@
   return self;
 }
 @end
+
+ at interface DTFilterOutputStream2
+- nextOutputStream;
+ at end
+
+ at 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 *')}}
+}
+ at end
+
+// No @interface declaration for DTFilterOutputStream3
+ at 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 *')}}
+}
+ at end





More information about the cfe-commits mailing list