brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · fcb1744 Raw
55 lines · plain
1// RUN: %clang_cc1 -fobjc-runtime=macosx-10.8 -fsyntax-only -verify %s2 3__attribute__((objc_root_class))4@interface Root @end5 6// These should not get diagnosed immediately.7@interface A : Root {8  __weak id x;9}10@property __weak id y;11@end12 13// Diagnostic goes on the ivar if it's explicit.14@interface B : Root {15  __weak id x;  // expected-error {{cannot create __weak reference in file using manual reference counting}}16}17@property __weak id x;18@end19@implementation B20@synthesize x;21@end22 23// Otherwise, it goes with the @synthesize.24@interface C : Root25@property __weak id x; // expected-note {{property declared here}}26@end27@implementation C28@synthesize x; // expected-error {{cannot synthesize weak property in file using manual reference counting}}29@end30 31@interface D : Root32@property __weak id x; // expected-note {{property declared here}}33@end34@implementation D // expected-error {{cannot synthesize weak property in file using manual reference counting}}35@end36 37@interface E : Root {38@public39  __weak id x; // expected-note 2 {{declaration uses __weak, but ARC is disabled}}40}41@end42 43void testE(E *e) {44  id x = e->x; // expected-error {{'x' is unavailable}}45  e->x = x; // expected-error {{'x' is unavailable}}46}47 48@interface F : Root49@property (weak) id x;50@end51 52void testF(F *f) {53  id x = f.x;54}55