Add test case to record a couple inconsistencies with GCC (found in <rdar://problem/6561076> [clang on Xcode] warning: cannot find protocol definition for 'OzzyP').

Removing the "cannot find protocol" warning is trivial if necessary (but I don't think it's the right thing to do).

llvm-svn: 65232
This commit is contained in:
Steve Naroff 2009-02-21 17:03:43 +00:00
parent 7a7814c32b
commit da88fb9c73
1 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,47 @@
// RUN: clang -fsyntax-only -verify %s
typedef signed char BOOL;
@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
@protocol NSObject
- (BOOL)isEqual:(id)object;
@end
@protocol NSCoding
- (void)encodeWithCoder:(NSCoder *)aCoder;
@end
@interface NSObject <NSObject> {} @end
@class NSArray, NSAttributedString, NSEvent, NSInputServer, NSImage;
@interface NSController : NSObject <NSCoding> {} @end
@class OzzyView;
typedef struct _OzzyInset {} OzzyInset;
@protocol OzzyP;
typedef NSObject <OzzyP> Ozzy;
@protocol OzzyAnchorP;
typedef NSObject <OzzyAnchorP> OzzyAnchor;
@protocol OzzyAnchorDelegateP
- (BOOL)anchor:(OzzyAnchor *)anchor confirmRepresentedObject:(id)newObject;
@end
typedef NSObject <OzzyAnchorDelegateP> OzzyAnchorDelegate;
// GCC doesn't warn about the following (which is inconsistent with it's handling of @interface below).
@protocol OzzyAnchorP <OzzyP> // expected-warning{{cannot find protocol definition for 'OzzyP'}}
@property(nonatomic,retain) id representedObject;
@property(nonatomic,retain) Ozzy * contentGroup;
@end
@interface XXX : NSObject <OzzyP> // expected-warning{{cannot find protocol definition for 'OzzyP'}}
@end
@protocol OzzyActionDelegateP
@optional - (BOOL)elementView:(OzzyView *)elementView shouldDragElement:(Ozzy *)element;
@end
typedef NSObject <OzzyActionDelegateP> OzzyActionDelegate;
@interface OzzyUnit : OzzyAnchorDelegate <OzzyAnchorDelegateP> {}
@end
@interface OzzyArrayUnit : OzzyUnit {} @end
@implementation OzzyArrayUnit
- (BOOL)willChangeLayoutForObjects:(NSArray *)objects fromObjects:(NSArray *)oldObjects {}
- (void)_recalculateStoredArraysForAnchor:(OzzyAnchor *)anchor {
Ozzy * contentGroup = anchor.contentGroup;
if (contentGroup == ((void *)0)) {
// GCC doesn't warn about the following (which seems wrong).
contentGroup = anchor; // expected-warning{{incompatible pointer types assigning 'OzzyAnchor *', expected 'Ozzy *'}}
}
}
@end