1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc@class FOO, BAR; // expected-note {{forward declaration of class here}} 4*f4a2713aSLionel Sambuc@class FOO, BAR; 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc@interface INTF : FOO // expected-error {{attempting to use the forward class 'FOO' as superclass of 'INTF'}} 7*f4a2713aSLionel Sambuc@end 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambuc@interface FOO 10*f4a2713aSLionel Sambuc- (BAR*) Meth1; 11*f4a2713aSLionel Sambuc- (FOO*) Meth2; 12*f4a2713aSLionel Sambuc@end 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc@interface INTF1 : FOO 15*f4a2713aSLionel Sambuc@end 16*f4a2713aSLionel Sambuc 17*f4a2713aSLionel Sambuc@interface INTF2 : INTF1 // expected-note {{previous definition is here}} 18*f4a2713aSLionel Sambuc@end 19*f4a2713aSLionel Sambuc 20*f4a2713aSLionel Sambuc 21*f4a2713aSLionel Sambuc@class INTF1, INTF2; 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc@interface INTF2 : INTF1 // expected-error {{duplicate interface definition for class 'INTF2'}} 24*f4a2713aSLionel Sambuc@end 25*f4a2713aSLionel Sambuc 26*f4a2713aSLionel Sambuc// 2nd test of a forward class declaration matching a typedef name 27*f4a2713aSLionel Sambuc// referring to class object. 28*f4a2713aSLionel Sambuc// FIXME. This may become a negative test should we decide to make this an error. 29*f4a2713aSLionel Sambuc// 30*f4a2713aSLionel Sambuc@interface NSObject @end 31*f4a2713aSLionel Sambuc 32*f4a2713aSLionel Sambuc@protocol XCElementP @end 33*f4a2713aSLionel Sambuc 34*f4a2713aSLionel Sambuctypedef NSObject <XCElementP> XCElement; // expected-note {{previous definition is here}} 35*f4a2713aSLionel Sambuc 36*f4a2713aSLionel Sambuc@interface XCElementMainImp { 37*f4a2713aSLionel Sambuc XCElement * _editingElement; 38*f4a2713aSLionel Sambuc} 39*f4a2713aSLionel Sambuc@end 40*f4a2713aSLionel Sambuc 41*f4a2713aSLionel Sambuc@class XCElement; // expected-warning {{redefinition of forward class 'XCElement' of a typedef name of an object type is ignored}} 42*f4a2713aSLionel Sambuc 43*f4a2713aSLionel Sambuc@implementation XCElementMainImp 44*f4a2713aSLionel Sambuc- (XCElement *)editingElement { return _editingElement; } 45*f4a2713aSLionel Sambuc@end 46*f4a2713aSLionel Sambuc 47*f4a2713aSLionel Sambuc 48*f4a2713aSLionel Sambuc// rdar://9653341 49*f4a2713aSLionel Sambuc@class B; // expected-note {{forward declaration of class here}} 50*f4a2713aSLionel Sambuc@interface A : B {} // expected-error {{attempting to use the forward class 'B' as superclass of 'A'}} 51*f4a2713aSLionel Sambuc@end 52*f4a2713aSLionel Sambuc 53*f4a2713aSLionel Sambuc@interface B : A {} 54*f4a2713aSLionel Sambuc@end 55*f4a2713aSLionel Sambuc 56*f4a2713aSLionel Sambuc@implementation A @end 57*f4a2713aSLionel Sambuc@implementation B @end 58*f4a2713aSLionel Sambuc 59