[LLVMbugs] [Bug 13446] New: There should be no default setter semantic on a readonly property

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 24 08:07:03 PDT 2012


             Bug #: 13446
           Summary: There should be no default setter semantic on a
                    readonly property
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: negm-awad at cocoading.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

A. Steps to reproduce:

1. Declare a readonly property in a header:
@interface MyClass : NSObject
@property (readonly) id property;

2. Switch to readwrite in a continuation or subclass. This makes setter
semantics necessary:
@interface MyClass()
@property (readwrite,copy) id property;

B. Existing behaviour:
Warning: Property attribute in continuation class does not match the primary

C. Reason:
The readonly declaration leaks of an explicit setter semantic. The compiler
defaults to assign. The class continuation changes the setter semantic to copy.

D. "Work-around"
Add the setter semantic to the readonly property:
@property (readonly,copy) id property;

E. Expected behaviour:
Since a readonly property does not deal with setter semantics, the compiler
should not default to anything. The setter semantics are only relevant for read
write properties. If the class continuation is used to keep the setter private,
the need of setter semantics in the interface discloses an implementation

F. Solution
Do not default the setter semantics to assign (or something else) in a readonly
property. Existing code would not break.

Amin Negm-Awad

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