[LLVMbugs] [Bug 7398] New: Objective-C: Properties from protocols adopted in a category are not known to the runtime

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 17 09:03:48 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=7398

           Summary: Objective-C: Properties from protocols adopted in a
                    category are not known to the runtime
           Product: new-bugs
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: kai at granus.net
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=5048)
 --> (http://llvm.org/bugs/attachment.cgi?id=5048)
Xcode project demonstrating the issue

Summary: 
The Obj-C runtime does not return references to properties using
class_getProperty when the following conditions are met:
- The property is declared in a protocol
- The protocol is implemented in a category
- The program is compiled using Clang/LLVM 1.5 (Xcode 3.2.3)

Because of the last condition (it works as expected with gcc) I am filing it
here as a compiler bug. It has been reported on 17.6.2010 that the problem
still occurs with the trunk version of Clang.

In the example below the first NSCAssert succeeds, the second fails. When
compiled with gcc both asserts succeed.

Also filed as rdar://8093297

-----------------

@protocol TestProtocol1
@property (readonly) NSString* testProperty1;
@end

@protocol TestProtocol2
@property (readonly) NSString* testProperty2;
@end

@interface TestClass : NSObject <TestProtocol1>
@end

@interface TestClass (TestCategory) <TestProtocol2>
@end

@implementation TestClass
- (NSString*)testProperty1 { return nil; }
@end

@implementation TestClass (TestCategory)
- (NSString*)testProperty2 { return nil; }
@end

int main (int argc, const char * argv[])
{
   Class testClass = [TestClass class];
   objc_property_t property1 = class_getProperty(testClass, "testProperty1");
   objc_property_t property2 = class_getProperty(testClass, "testProperty2");
   NSCAssert(property1 != NULL, @"Property1 from protocol implemented on class
is not found");
   NSCAssert(property2 != NULL, @"Property2 from protocol implemented on
category is not found");
   return 0;
}

-- 
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