| 1 |
// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify -Wno-objc-root-class %s |
| 2 |
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class -DNOARC %s |
| 3 |
#ifdef NOARC |
| 4 |
// expected-no-diagnostics |
| 5 |
#endif |
| 6 |
|
| 7 |
@interface RetainableArray { |
| 8 |
id flexible[]; |
| 9 |
#ifndef NOARC |
| 10 |
// expected-error@-2 {{ARC forbids flexible array members with retainable object type}} |
| 11 |
#endif |
| 12 |
} |
| 13 |
@end |
| 14 |
@implementation RetainableArray |
| 15 |
@end |
| 16 |
|
| 17 |
// Emit diagnostic only if have @implementation. |
| 18 |
@interface RetainableArrayWithoutImpl { |
| 19 |
id flexible[]; |
| 20 |
} |
| 21 |
@end |
| 22 |
|
| 23 |
// With ARC flexible array member objects can be only __unsafe_unretained |
| 24 |
@interface UnsafeUnretainedArray { |
| 25 |
__unsafe_unretained id flexible[]; |
| 26 |
} |
| 27 |
@end |
| 28 |
@implementation UnsafeUnretainedArray |
| 29 |
@end |
| 30 |
|
| 31 |
@interface NotObjCLifetimeTypeArray { |
| 32 |
char flexible[]; |
| 33 |
} |
| 34 |
@end |
| 35 |
@implementation NotObjCLifetimeTypeArray |
| 36 |
@end |