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: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [email protected]


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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to