4

テスト ターゲットを iPad1 (4.3.5) または iPhone4 (4.3.5) にビルドしようとすると、Xcode 4 (ビルド 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 デバイス用にビルドする場合、GHUnitIOS-0.4.32 (および GHUnitIOS-0.4.31) で Xcode 4.1 を使用します。シミュレータ用にビルドする場合は問題がないことに注意してください。

コンパイラ エラーには、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);
}

GHAssertEqualObjectsGHAssertEqualStringsGHAssertEqualsGHAssertFalseGHAssertNilGHAssertNotNilおよびGHAssertTrueconst NSString (つまり @"some string") を使用した呼び出しは、コンパイラ エラーを引き起こさなかったことに注意してください。

と の使用を調べる#define GHAssertNotEquals(a1, a2, description, ...)と、どちらも を呼び出しますが、動作する他のマクロも同様です。#define GHAssertEqualObjects(a1, a2, description, ...)descriptionGHComposeString(description, ##__VA_ARGS__)

于 2011-09-07T16:56:48.350 に答える