1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010. */
2 /* { dg-do compile } */
6 /* Test that you can not declare two methods, in the same protocol,
7 with the same name and method signature, but one as @required and
10 /* First, @required conflicting with @optional. */
14 + (void) method1: (id)x; /* { dg-message "previous declaration" } */
15 - (id) method2: (long)x; /* { dg-message "previous declaration" } */
18 + (void) method1: (id)x; /* { dg-error "declared .@optional. and .@required. at the same time" } */
19 - (id) method2: (long)x; /* { dg-error "declared .@optional. and .@required. at the same time" } */
23 /* Second, @optional conflicting with @required. */
27 + (void) method3: (Class)x; /* { dg-message "previous declaration" } */
28 - (id *) method4: (long)x; /* { dg-message "previous declaration" } */
31 + (void) method3: (Class)x; /* { dg-error "declared .@optional. and .@required. at the same time" } */
32 - (id *) method4: (long)x; /* { dg-error "declared .@optional. and .@required. at the same time" } */