Improve the forward declare protocols test.

Make it not fail to build with older compilers and make it test the
thing that should be true with the new ABI.
main
David Chisnall 8 years ago
parent f7a21aaf4d
commit 6ab3df0892

@ -3,5 +3,12 @@
Protocol *getProtocol(void)
{
// Don't try to compile this on known-broken compilers.
#if !defined(__clang__)
return @protocol(P);
#elif __clang_major__ > 6
return @protocol(P);
#else
return 0;
#endif
}

@ -9,9 +9,12 @@ Protocol *getProtocol(void);
int main(void)
{
//Protocol *p1 = @protocol(P);
Protocol *p1 = @protocol(P);
Protocol *p2 = getProtocol();
//assert(protocol_isEqual(p1, p2));
//assert(p1 == p2);
assert(protocol_isEqual(p1, p2));
#ifdef GS_RUNTIME_V2
// With the new ABI, these should be precisely the same object.
assert(p1 == p2);
#endif
return 0;
}

Loading…
Cancel
Save