1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010. */
2 /* { dg-options "-fobjc-exceptions" } */
3 /* { dg-do compile } */
5 /* Test that the compiler is checking the argument of @synchronized(),
6 and produce errors when invalid types are used. */
16 @implementation MyObject
21 typedef MyObject MyObjectTypedef;
22 typedef MyObject *MyObjectPtrTypedef;
23 typedef int intTypedef;
25 typedef struct { float x; float y; } point, *point_ptr;
33 @synchronized (x) /* { dg-error ".@synchronized. argument is not an object" } */
39 @synchronized (x) /* { dg-error ".@synchronized. argument is not an object" } */
45 @synchronized (x) /* { dg-error ".@synchronized. argument is not an object" } */
51 @synchronized (x) /* { dg-error ".@synchronized. argument is not an object" } */
57 @synchronized (x) /* { dg-error ".@synchronized. argument is not an object" } */
63 @synchronized (x) /* Ok */
69 @synchronized (x) /* Ok */
75 @synchronized (x) /* Ok */
80 MyObject <MyProtocol> *x;
81 @synchronized (x) /* Ok */
87 @synchronized (x) /* Ok */
93 @synchronized (x) /* Ok */
98 MyObjectTypedef <MyProtocol> *x;
99 @synchronized (x) /* Ok */
104 MyObjectPtrTypedef x;
105 @synchronized (x) /* Ok */
111 @synchronized (x) /* Ok */
115 @synchronized (1) /* { dg-error ".@synchronized. argument is not an object" } */
118 @synchronized ("Test") /* { dg-error ".@synchronized. argument is not an object" } */
121 @synchronized () /* { dg-error "expected" } */
124 @synchronized (int) /* { dg-error "expected" } */