OSDN Git Service

Backported from mainline
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / obj-c++.dg / naming-1.mm
1 /* Testing for detecting duplicate ivars. */
2 /* { dg-do compile } */
3
4 typedef struct S { int i; } NSDictionary;
5
6 @interface A 
7 {
8     NSDictionary * _userInfo1; /* { dg-message "previous declaration" } */
9     NSDictionary * _userInfo2; /* { dg-message "previous declaration" } */
10     NSDictionary * _userInfo3; /* { dg-message "previous declaration" } */
11     NSDictionary * _userInfo4; /* { dg-message "previous declaration" } */
12 }
13 @end
14
15 @interface B : A
16 {
17     NSDictionary * _userInfo1;  /* { dg-error "duplicate instance variable" } */
18     NSDictionary * _userInfo2;  /* { dg-error "duplicate instance variable" } */
19 }
20 @end
21
22 @interface C : A
23 @end
24
25 @interface D : C
26 {
27     NSDictionary * _userInfo3;  /* { dg-error "duplicate instance variable" } */
28     NSDictionary * _userInfo4;  /* { dg-error "duplicate instance variable" } */
29 }
30 @end
31