1 // RUN: %clang_cc1 -fobjc-nonfragile-abi -verify -fsyntax-only %s
6 int g0 = sizeof(I0); // expected-error{{invalid application of 'sizeof' to an incomplete type 'I0'}}
10 P = P+5; // expected-error {{arithmetic on pointer to incomplete type 'I0 *'}}
12 return &P[4]; // expected-error{{subscript of pointer to incomplete type 'I0'}}
26 int g1[ sizeof(I0) // expected-error {{invalid application of 'sizeof' to interface 'I0' in non-fragile ABI}}
33 // size == 4 (we do not include extended properties in the
35 int g2[ sizeof(I0) // expected-error {{invalid application of 'sizeof' to interface 'I0' in non-fragile ABI}}
46 typedef struct { @defs(I1); } I1_defs; // expected-error {{invalid application of @defs in non-fragile ABI}}
48 // FIXME: This is currently broken due to the way the record layout we
49 // create is tied to whether we have seen synthesized properties. Ugh.
50 // int g3[ sizeof(I1) == 0 ? 1 : -1];
54 P = P+5; // expected-error {{arithmetic on pointer to interface 'I0', which is not a constant size in non-fragile ABI}}
55 P = 5+P; // expected-error {{arithmetic on pointer to interface 'I0', which is not a constant size in non-fragile ABI}}
56 P = P-5; // expected-error {{arithmetic on pointer to interface 'I0', which is not a constant size in non-fragile ABI}}
58 return P[4].x[2]; // expected-error {{subscript requires size of interface 'I0', which is not constant in non-fragile ABI}}
64 @interface XCAttributeRunDirectNode
67 unsigned long attributeRuns[1024 + sizeof(I)]; // expected-error {{invalid application of 'sizeof' to interface 'I' in non-fragile ABI}}
72 @implementation XCAttributeRunDirectNode
74 - (unsigned long)gatherStats:(id )stats
76 return attributeRuns[i];
87 // Both of these crash clang nicely
88 ++f; // expected-error {{arithmetic on pointer to interface 'Foo', which is not a constant size in non-fragile ABI}}
89 --f; // expected-error {{arithmetic on pointer to interface 'Foo', which is not a constant size in non-fragile ABI}}