Я столкнулся с той же ошибкой компилятора:
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
При использовании Xcode 4.1 с GHUnitIOS-0.4.32 (и GHUnitIOS-0.4.31) при сборке для устройств iOS.Обратите внимание, что при сборке для симулятора проблем не возникает.
Ошибки компилятора связаны с вызовами GHAssertNotEqualObjects
и GHAssertNotEquals
.
Шаблон кода, который я использовал, когда получил ошибку компилятора.было следующее:
- (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)");
}
Мне удалось скомпилировать код со следующей модификацией:
- (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);
}
Обратите внимание, что вызовы GHAssertEqualObjects
, GHAssertEqualStrings
, GHAssertEquals
, GHAssertFalse
, GHAssertNil
, GHAssertNotNil
и GHAssertTrue
с использованием const NSString, то есть @ "some string", не вызывали ошибку компилятора.
Просмотр #define GHAssertNotEquals(a1, a2, description, ...)
и #define GHAssertEqualObjects(a1, a2, description, ...)
и их использование description
, оба вызывают GHComposeString(description, ##__VA_ARGS__)
, но и другие макросы, которые работают.