[cfe-dev] Instance variables in implementation error?
fjahanian at apple.com
Mon Jul 4 09:41:13 PDT 2011
On Jul 3, 2011, at 2:33 PM, Marcel Weiher wrote:
> Hi folks,
> I am working on a code-base that for various reasons has instance variables declared in both the @interface and the @implementation section. Using gcc 4.2, this is OK, but clang in 64 bit aborts with the following error:
> [elided] ../../src/Error.m:13:10: error: instance variable is already declared 
> BOOL _isExceptional;
> Which is true, that is exactly what's happening, it was just OK (if questionable) before.
> In 32 bit mode, clang is OK with this, as is gcc 4.2 in both 32 bit and 64 bit mode. Any way to turn this error off in clang 64 bit mode?
-m64 uses the non-fragile abi. This mode has a few language extensions, one of which is allowing to add 'private' ivars
to the class via @implementation. So, each ivar is checked against existing ivars and diagnostic is issued for a redeclaration.
You can work around this problem by adding -fno-objc-nonfragile-abi to your command line. But I should caution that
we don't test nonfragile-abi in 64bit mode. And you may likely run into other issues.
> I tried setting the Objective-C language level using the (gcc) flag '-fobjc-std=objc1' but that doesn't seem to make a difference. I did a search of the clang pages at http://clang.llvm.org/docs/UsersManual.html but the link to "Objective-C language features" is a dead link ( http://clang.llvm.org/docs/UsersManual.html#objc ), as is the C++ link. The C language features link works.
> I also tried to search the code via the error message, but that wasn't too illuminating either.
> For now, I can probably get by with using gcc 4.2, but I'd much prefer to use clang.
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev