blob: 3bbe18db70234472402f3dad754fd55c397f1ccc [file] [log] [blame]
Chris Lattnerca790922009-04-21 19:55:16 +00001// RUN: clang-cc -triple x86_64-apple-darwin9 -verify -fsyntax-only %s
Daniel Dunbarff896662009-04-21 15:48:54 +00002
3@class I0;
Chris Lattnerca790922009-04-21 19:55:16 +00004
5// rdar://6811884
6int g0 = sizeof(I0); // expected-error{{invalid application of 'sizeof' to a forward declared interface 'I0'}}
Daniel Dunbarff896662009-04-21 15:48:54 +00007
8@interface I0 {
9 char x[4];
10}
11
12@property int p0;
13@end
14
15// size == 4
Chris Lattnerca790922009-04-21 19:55:16 +000016int g1[ sizeof(I0) // expected-error {{invalid application of 'sizeof' to interface 'I0' in non-fragile ABI}}
17 == 4 ? 1 : -1];
Daniel Dunbarff896662009-04-21 15:48:54 +000018
19@implementation I0
20@synthesize p0 = _p0;
21@end
22
23// size == 4 (we do not include extended properties in the
24// sizeof).
Chris Lattnerca790922009-04-21 19:55:16 +000025int g2[ sizeof(I0) // expected-error {{invalid application of 'sizeof' to interface 'I0' in non-fragile ABI}}
26 == 4 ? 1 : -1];
Daniel Dunbarff896662009-04-21 15:48:54 +000027
28@interface I1
29@property int p0;
30@end
31
32@implementation I1
33@synthesize p0 = _p0;
34@end
35
Fariborz Jahanian0468fb92009-04-21 20:28:41 +000036typedef struct { @defs(I1) } I1_defs; // expected-error {{invalid application of @defs in non-fragile ABI}}
37
Daniel Dunbarff896662009-04-21 15:48:54 +000038// FIXME: This is currently broken due to the way the record layout we
39// create is tied to whether we have seen synthesized properties. Ugh.
40// int g3[ sizeof(I1) == 0 ? 1 : -1];