[LLVMbugs] [Bug 2877] New: Clang parser ignores protocol information of referenced properties
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Fri Oct 10 02:37:07 PDT 2008
http://llvm.org/bugs/show_bug.cgi?id=2877
Summary: Clang parser ignores protocol information of referenced
properties
Product: clang
Version: unspecified
Platform: Macintosh
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: parser
AssignedTo: unassignedbugs at nondot.org
ReportedBy: nikita at zhuk.fi
CC: llvmbugs at cs.uiuc.edu
If a protocol declares a property and a class declares property which
implementes that protocol, then referencing the property which is declared in
the protocol through property declared in the class causes parser to reject the
source code.
A test case which succeeds with GCC but fails with clang (revision 57238):
#import <Foundation/Foundation.h>
@protocol MyProtocol <NSObject>
@property(readonly) NSString *stringValue;
@end
@interface MyClass : NSObject {
id<MyProtocol> _myIvar;
}
@property(readonly) id<MyProtocol> ivar;
@end
@implementation MyClass
@synthesize ivar = _myIvar;
@end
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
MyClass *obj = [[[MyClass alloc] init] autorelease];
NSLog(@"String via property = '%@'", obj.ivar.stringValue);
[pool drain];
return 0;
}
Running the above code with clang -fsyntax-only produces the following error:
ProtocolPropertyTest.m:21:51: error: member reference base type
('id<MyProtocol>') is not a structure or union
NSLog(@"String via property = '%@'", obj.ivar.stringValue);
~~~~~~~~ ^
1 diagnostic generated.
--
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