[LLVMbugs] [Bug 4431] New: Can't declare a property as an alias of another.
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Mon Jun 22 18:31:59 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=4431
Summary: Can't declare a property as an alias of another.
Product: clang
Version: unspecified
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Keywords: compile-fail
Severity: normal
Priority: P2
Component: Basic
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: stevencanfield at gmail.com
CC: llvmbugs at cs.uiuc.edu
If I declare two properties and synthesize both to the same instance variable,
clang will report an error. The error is of the form 'synthesized properties %0
and %1 both claim ivar %2' (and is called error_duplicate_ivar_use internally).
I am using this heavily in my current project to interface with legacy code.
For example,
@interface Person : NSObject {
NSString* first_name;
}
@property (nonatomic,retain) NSString* first_name;
@property (nonatomic,retain) NSString* firstName; // New Style alias
@end
@implementation Person
@synthesize firstName=first_name, first_name;
@end
The goal here is that older code in the (large) codebase uses the first_name
accessor or in some places is dependent on database column names. At some point
these will be cleaned out but for the foreseeable future I would like to keep
first_name available. However, it is not the proper style so for new code I'd
like to be able to reference firstName. This has been allowed in GCC through
4.2 and is only an error in Clang.
I'm happy to provide a patch to change this (it's trivial) but I wanted to see
people's opinions first. Is this a dangerous 'feature' ? I couldn't find
anything in the (admittedly limited) Objective C 2.0 reference to decide either
way.
--
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