Debian Codegraph @

gcc/testsuite/objc.dg/method-1.m

raw
1 /* Tests of duplication. */
2 /* { dg-do compile } */
3 /* { dg-additional-options "-Wno-objc-root-class" } */
4
5 @interface class1
6 - (int) meth1; /* { dg-message "previous declaration" } */
7 - (void) meth1; /* { dg-error "duplicate declaration of method .\\-meth1." } */
8 @end
9
10 @interface class2
11 + (void) meth1; /* { dg-message "previous declaration" } */
12 + (int) meth1; /* { dg-error "duplicate declaration of method .\\+meth1." } */
13 @end
14
15 @interface class3
16 - (int) meth1;
17 @end
18
19 @implementation class3
20 - (int) meth1 { return 0; } /* { dg-message "previous definition" } */
21 - (int) meth1 { return 0; } /* { dg-error "redefinition of" } */
22 @end
23
24 @interface class4
25 + (void) meth1;
26 @end
27
28 @implementation class4
29 + (void) meth1 {} /* { dg-message "previous definition" } */
30 + (void) meth1 {} /* { dg-error "redefinition of" } */
31 @end