Getting LLVM error when building to device but not in simulator
When I attempt to build my test target to either my iPad1 (4.3.5) or iPhone4 (4.3.5) I'm getting the following error from Xcode 4 (Build 4A304a):
Internal compiler error: tree check: expected tree that contains 'decl with visibility' structure, have 'const_decl' in c_common_truthvalue_conversion
But not when the Test Target is switched to build in the simulator.
The line of code that is borking is
GHAssertNotNULL(xxxObject, @"xxxObject could not be 开发者_运维知识库created");
(objects have been renamed to protect the innocent ;-) ) But I can say it is a singleton.
I've search google and didnt get anything relevant for this error.
Thanking you in advance Ian.
I experienced the same compiler error:
internal compiler error: tree check: expected tree that contains 'decl with visibility' structure, have 'const_decl' in c_common_truthvalue_conversion, at c-common.c:2836
Using Xcode 4.1 with GHUnitIOS-0.4.32 (and GHUnitIOS-0.4.31) when building for iOS devices. Note there is no issue when building for the simulator.
The complier errors involved calls to GHAssertNotEqualObjects
and GHAssertNotEquals
.
The code pattern that I was using when I received the compiler error was of the following:
- (void) test_isEqual {
SomeObject *foo = [[SomeObject alloc] initWithValue: 1];
SomeObject *bar = [[SomeObject alloc] initWithValue: 2];
GHAssertNotEquals(bar, foo, @"Different Objects, different values - different pointers");
GHAssertNotEqualObjects(bar, foo, @"Different Objects, different values - different pointers (calls isEqual)");
}
I was able to compile the code with the following modification:
- (void) test_isEqual {
NSString *comment;
SomeObject *foo = [[SomeObject alloc] initWithValue: 1];
SomeObject *bar = [[SomeObject alloc] initWithValue: 2];
comment = @"Different Objects, different values - different pointers";
GHAssertNotEquals(bar, foo, comment);
comment = @"Different Objects, different values - different pointers (calls isEqual)";
GHAssertNotEqualObjects(bar, foo, comment);
}
Note that calls to GHAssertEqualObjects
, GHAssertEqualStrings
, GHAssertEquals
, GHAssertFalse
, GHAssertNil
, GHAssertNotNil
, and GHAssertTrue
using a const NSString, i.e. @"some string", did not cause a compiler error.
Looking into #define GHAssertNotEquals(a1, a2, description, ...)
and #define GHAssertEqualObjects(a1, a2, description, ...)
and their use of description
, both call GHComposeString(description, ##__VA_ARGS__)
, but so do the others macros that work.
精彩评论