Created
March 20, 2011 00:41
-
-
Save rentzsch/877952 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@protocol ProtocolWithMethod | |
- (void)protocolMethod; | |
@end | |
@protocol ProtocolWithProperty | |
@property(retain) NSString *protocolProperty; | |
@end | |
// Trival base class that satisfies both protocols. | |
@interface BaseClass : NSObject {} | |
@property(retain) NSString *protocolProperty; | |
- (void)protocolMethod; | |
@end | |
@implementation BaseClass | |
@synthesize protocolProperty; | |
- (void)protocolMethod {} | |
@end | |
// Fine: compiler figures out ProtocolWithMethod's requirement for -protocolMethod was | |
// satisfied by BaseClass. | |
@interface SubClassImplementingProtocolWithMethod : BaseClass <ProtocolWithMethod> {} | |
@end | |
@implementation SubClassImplementingProtocolWithMethod | |
@end | |
// This class yields 2 warnings: | |
// 1. "property 'protocolProperty' requires method '-protocolProperty' to be defined - use | |
// @synthesize, @dynamic or provide a method implementation" | |
// 2. "property 'protocolProperty' requires the method 'setProtocolProperty:' to be | |
// defined - use @synthesize, @dynamic or provide a method implementation" | |
// The same warnings are issued across GCC 4.2, LLVM GCC 4.2 and clang 1.6, so I suppose | |
// this is Works As Intended. | |
@interface SubClassImplementingProtocolWithProperty : BaseClass <ProtocolWithProperty> {} | |
@end | |
@implementation SubClassImplementingProtocolWithProperty | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sounds like rdar://6854729 again
Works fine in clang though.
//OCidentity.h
@interface OCIdentity
@Property (nonatomic, readonly, retain) NSString *rawID;
@EnD
//OCIdentityIM.h
@protocol OCIdentityIM
@EnD
//OCInstantMessage.h
//#import "OCIdentity.h"
//#import "OCIdentityIM.h"
@interface OCInstantMessage : NSObject {
OCIdentity *sender;
OCIdentity *recipient;
}
@EnD
@implementation OCInstantMessage
return [NSString stringWithFormat:@"%@", sender.rawID];
}
@EnD
Classes/OCInstantMessage.m: error: request for member 'rawID' in something not a structure or union