]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/SemaObjC/class-def-test-1.m
Vendor import of clang trunk r154661:
[FreeBSD/FreeBSD.git] / test / SemaObjC / class-def-test-1.m
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2
3 @protocol SUPER;
4
5 @interface SUPER <SUPER> @end // expected-warning {{cannot find protocol definition for 'SUPER'}}
6
7 typedef int INTF; //  expected-note {{previous definition is here}}
8
9 @interface INTF @end // expected-error {{redefinition of 'INTF' as different kind of symbol}}
10
11 @interface OBJECT @end  // expected-note {{previous definition is here}}
12
13 @interface INTF1 : OBJECT @end // expected-note {{previous definition is here}}
14
15 @interface INTF1 : OBJECT @end // expected-error {{duplicate interface definition for class 'INTF1'}}
16
17 typedef int OBJECT; // expected-error {{redefinition of 'OBJECT' as different kind of symbol}}
18
19 typedef int OBJECT2; // expected-note {{previous definition is here}}
20 @interface INTF2 : OBJECT2 @end // expected-error {{redefinition of 'OBJECT2' as different kind of symbol}}
21
22
23 @protocol PROTO;
24
25 @interface INTF3 : PROTO @end // expected-error {{cannot find interface declaration for 'PROTO', superclass of 'INTF3'}}
26
27 // Make sure we allow the following (for GCC compatibility).
28 @interface NSObject @end
29 typedef NSObject TD_NSObject;
30 @interface XCElementUnit : TD_NSObject {}
31 @end
32
33 // Make sure we don't typo-correct to ourselves.
34 @interface SomeClassSub : SomeClassSup // expected-error{{cannot find interface declaration for 'SomeClassSup', superclass of 'SomeClassSub'}}
35 @end