if (Setter && DiagnoseUseOfDecl(Setter, MemberLoc))
return ExprError();
- if (Getter || Setter) {
+ if (Getter) {
QualType PType;
-
- if (Getter)
- PType = Getter->getResultType();
- else
- // Get the expression type from Setter's incoming parameter.
- PType = (*(Setter->param_end() -1))->getType();
- // FIXME: we must check that the setter has property type.
+ PType = Getter->getResultType();
return Owned(new (Context) ObjCImplicitSetterGetterRefExpr(Getter, PType,
Setter, MemberLoc, BaseExpr));
}
}
@end
+@interface C {}
+// - (int)Foo;
+- (void)setFoo:(int)value;
+@end
+
+void g(int);
+
+void f(C *c) {
+ c.Foo = 17; // expected-error {{property 'Foo' not found on object of type 'C *'}}
+ g(c.Foo); // expected-error {{property 'Foo' not found on object of type 'C *'}}
+}
+
+
void abort(void);
int main (void) {
Subclass *x = [[Subclass alloc] init];
- x.setterOnly = 4;
+ x.setterOnly = 4; // expected-error {{property 'setterOnly' not found on object of type 'Subclass *'}}
if (g_val != 4)
abort ();
return 0;