4

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.

Lebyrt
  • 1,376
  • 1
  • 9
  • 18
ShogoDodo
  • 63
  • 2
  • Before someone suggests it I have already performed Product -> Clean. – ShogoDodo Jul 28 '11 at 08:49
  • As I cant answer my own question for another 6 hours, this is the answer I attempted to submit : - – ShogoDodo Jul 28 '11 at 10:03
  • I think I have answered the problem. Initially it was a school-boy error on my behalf. I shouldn't have been testing for null when the error condition returned would be nil. Sounds easy-peasy so far. I corrected the code and compiled again. Same error but a much different scenario, performing a GreaterThan compare between an off_t value and zero (cast to off_t). To cut a long story short I suspect the issue is 32 v 64-bit related (between the iPad and Simulator respectively). – ShogoDodo Jul 28 '11 at 10:03

1 Answers1

2

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.

mmorris
  • 4,006
  • 3
  • 27
  • 29
  • Thx! I had the same issue. I was able to get around it by using a slightly different custom assert macro. By passing the string constant pointer, rather than inlining it in the function call, I overcame the issue reliably. – pchap10k Oct 09 '11 at 06:58