1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
3 @interface SomeClass @end
5 int fn1(SomeClass *obj) {
6 obj->privateIvar = 1; // expected-error {{'SomeClass' does not have a member named 'privateIvar}}
7 return obj->publicIvar; // expected-error {{'SomeClass' does not have a member named 'publicIvar'}}
10 @interface SomeClass () {
11 // @private by default
18 int fn2(SomeClass *obj) {
20 return obj->publicIvar // ok
21 + obj->privateIvar; // expected-error {{instance variable 'privateIvar' is private}}
24 @implementation SomeClass
26 int fn3(SomeClass *obj) {
28 return obj->publicIvar // ok
29 + obj->privateIvar; // ok
33 @interface SomeClass (Category)
35 int categoryIvar; // expected-error {{instance variables may not be placed in categories}}
39 @interface SomeClass (Category1)