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.