4

当我尝试将测试目标构建到我的 iPad1 (4.3.5) 或 iPhone4 (4.3.5) 时,我从 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

但不是当测试目标切换到在模拟器中构建时。

无聊的代码行是

GHAssertNotNULL(xxxObject, @"xxxObject could not be created");

(对象已重命名以保护无辜者;-))但我可以说它是一个单身人士。

我搜索了谷歌并没有得到任何与此错误相关的信息。

提前感谢你,伊恩。

4

1 回答 1

2

我遇到了同样的编译器错误:

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

为 iOS 设备构建时,将 Xcode 4.1 与 GHUnitIOS-0.4.32(和 GHUnitIOS-0.4.31)一起使用。请注意,为模拟器构建时没有问题。

编译器错误涉及对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,GHAssertNotNilGHAssertTrue使用 const NSString,即 @"some string",不会导致编译器错误。

研究#define GHAssertNotEquals(a1, a2, description, ...)and#define GHAssertEqualObjects(a1, a2, description, ...)和他们的使用description,都调用GHComposeString(description, ##__VA_ARGS__),但其他宏也是如此。

于 2011-09-07T16:56:48.350 回答