[LLVMbugs] [Bug 4555] New: Doesn't support valid obj-c declaration: -(Class<MyClass>) currentCounterPolicy
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Tue Jul 14 03:43:44 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=4555
Summary: Doesn't support valid obj-c declaration: -
(Class<MyClass>) currentCounterPolicy
Product: clang
Version: unspecified
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: major
Priority: P2
Component: parser
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: macta at pobox.com
CC: llvmbugs at cs.uiuc.edu
XCode 3.1.x correctly compiles the following (only snippets shown - but I think
the idea should be clear. Basically it provides a hierarchy of Policy counter
objects, classes are used as singleton objects - each with a different static
implementation):
Clang gives the following error:
Model.h:38:22: error: protocol qualified 'Class' is unsupported
-(Class<CounterPolicy>) currentCounterPolicy;
~~~~~~~~~~~~~~~~~~~^
1 diagnostic generated.
Code snippets:
Model.h
...
#import "ModelPolicies.h"
...
@interface Model : NSObject {
// inst var declarations etc.
...
// The line Clang reports an error on
-(Class<CounterPolicy>) currentCounterPolicy;
Model.m
....
// Create a static list of counter policy objects
+(NSArray *) availableCounters {
return [[[NSArray alloc] initWithObjects: [CurrentListCounter class],
[FavouritesCounter class], [AllListsCounter class], [NullCounter class], nil]
autorelease];
}
-(Class<CounterPolicy>) currentCounterPolicy {
return [[Model availableCounters] objectAtIndex:
self.badgeCounterIndex];
}
ModelPolicies.h
@protocol CounterPolicy
+(NSInteger) countFor: (MyModel *)model;
+(NSString *) description;
@end
@interface CurrentListCounter : NSObject <CounterPolicy>
+(NSInteger) badgeCountFor: (MyModel *)model;
+(NSString *) description;
@end
@interface NullCounter : NSObject <CounterPolicy>
+(NSInteger) badgeCountFor: (MyModel *)model;
+(NSString *) description;
@end
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list