annotate clang/test/SemaObjC/duplicate-ivar-in-class-extension.m @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 @interface Root @end
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 @interface SuperClass : Root
anatofuz
parents:
diff changeset
6 {
anatofuz
parents:
diff changeset
7 int iSuper; // expected-note {{previous declaration is here}}
anatofuz
parents:
diff changeset
8 }
anatofuz
parents:
diff changeset
9 @end
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 @interface SubClass : SuperClass {
anatofuz
parents:
diff changeset
12 int ivar; // expected-error {{duplicate member 'ivar'}}
anatofuz
parents:
diff changeset
13 int another_ivar; // expected-error {{duplicate member 'another_ivar'}}
anatofuz
parents:
diff changeset
14 int iSuper; // expected-error {{duplicate member 'iSuper'}}
anatofuz
parents:
diff changeset
15 }
anatofuz
parents:
diff changeset
16 @end
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 @interface SuperClass () {
anatofuz
parents:
diff changeset
19 int ivar; // expected-note {{previous declaration is here}}
anatofuz
parents:
diff changeset
20 }
anatofuz
parents:
diff changeset
21 @end
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 @interface Root () {
anatofuz
parents:
diff changeset
24 int another_ivar; // expected-note {{previous declaration is here}}
anatofuz
parents:
diff changeset
25 }
anatofuz
parents:
diff changeset
26 @end
anatofuz
parents:
diff changeset
27
anatofuz
parents:
diff changeset
28 @implementation SubClass
anatofuz
parents:
diff changeset
29 -(int) method {
anatofuz
parents:
diff changeset
30 return self->ivar; // would be ambiguous if the duplicate ivar were allowed
anatofuz
parents:
diff changeset
31 }
anatofuz
parents:
diff changeset
32 @end