brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 377f50d Raw
68 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s2 3struct X {4  X();5  X(const X&);6  ~X();7 8  static int staticData;9  int data;10  void method();11};12 13@interface A {14  X xval;15}16 17- (X)x;18- (void)setx:(X)x;19@end20 21void f(A* a) {22  a.x = X(); // expected-error {{no setter method 'setX:' for assignment to property}}23}24 25struct Y : X { };26 27@interface B {28@private29  Y *y;30}31- (Y)value;32- (void)setValue : (Y) arg;33@property Y value;34@end35 36void g(B *b) {37  b.value.data = 17; // expected-error {{not assignable}}38  b.value.staticData = 17;39  b.value.method();40}41 42@interface C43@end44 45@implementation C46- (void)method:(B *)b {47  b.operator+ = 17; // expected-error{{'operator+' is not a valid property name (accessing an object of type 'B *')}}48  b->operator+ = 17; // expected-error{{'B' does not have a member named 'operator+'}}49}50@end51 52// PR975953class Forward;54@interface D { // expected-note 2 {{'D' declared here}}55@public56  int ivar;57}58 59@property int property;60@end61 62void testD(D *d) {63  d.Forward::property = 17; // expected-error{{property access cannot be qualified with 'Forward'}}64  d->Forward::ivar = 12; // expected-error{{instance variable access cannot be qualified with 'Forward'}}65  d.D::property = 17; // expected-error{{'D' is not a class, namespace, or enumeration}}66  d->D::ivar = 12; // expected-error{{'D' is not a class, namespace, or enumeration}}67}68