Patrick Beard | b2f6820 | 2012-04-06 18:12:22 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s |
Fariborz Jahanian | 4b6df3f | 2007-10-04 00:22:33 +0000 | [diff] [blame] | 2 | |
Douglas Gregor | b302996 | 2011-11-14 22:10:01 +0000 | [diff] [blame] | 3 | @class SUPER, Y; // expected-note 2 {{forward declaration of class here}} |
Fariborz Jahanian | 1d5b0e3 | 2007-09-20 17:54:07 +0000 | [diff] [blame] | 4 | |
Fariborz Jahanian | a813973 | 2011-06-23 23:16:19 +0000 | [diff] [blame] | 5 | @interface INTF :SUPER // expected-error {{attempting to use the forward class 'SUPER' as superclass of 'INTF'}} |
Fariborz Jahanian | 1d5b0e3 | 2007-09-20 17:54:07 +0000 | [diff] [blame] | 6 | @end |
| 7 | |
| 8 | @interface SUPER @end |
| 9 | |
Chris Lattner | b8b96af | 2008-11-23 22:46:27 +0000 | [diff] [blame] | 10 | @interface INTF1 : SUPER // expected-note {{previous definition is here}} |
Fariborz Jahanian | 1d5b0e3 | 2007-09-20 17:54:07 +0000 | [diff] [blame] | 11 | @end |
| 12 | |
| 13 | @interface INTF2 : INTF1 |
| 14 | @end |
| 15 | |
Fariborz Jahanian | a813973 | 2011-06-23 23:16:19 +0000 | [diff] [blame] | 16 | @interface INTF3 : Y // expected-error {{attempting to use the forward class 'Y' as superclass of 'INTF3'}} \ |
Douglas Gregor | a6f2638 | 2010-01-06 23:44:25 +0000 | [diff] [blame] | 17 | // expected-note{{'INTF3' declared here}} |
Fariborz Jahanian | 1d5b0e3 | 2007-09-20 17:54:07 +0000 | [diff] [blame] | 18 | @end |
| 19 | |
Chris Lattner | b8b96af | 2008-11-23 22:46:27 +0000 | [diff] [blame] | 20 | @interface INTF1 // expected-error {{duplicate interface definition for class 'INTF1'}} |
Fariborz Jahanian | 1d5b0e3 | 2007-09-20 17:54:07 +0000 | [diff] [blame] | 21 | @end |
Steve Naroff | 9511096 | 2008-03-28 21:37:05 +0000 | [diff] [blame] | 22 | |
| 23 | @implementation SUPER |
| 24 | - (void)dealloc { |
Ted Kremenek | e00909a | 2011-01-23 17:21:34 +0000 | [diff] [blame] | 25 | [super dealloc]; // expected-error {{'SUPER' cannot use 'super' because it is a root class}} |
Steve Naroff | 9511096 | 2008-03-28 21:37:05 +0000 | [diff] [blame] | 26 | } |
| 27 | @end |
Fariborz Jahanian | fdee089 | 2009-07-09 22:08:26 +0000 | [diff] [blame] | 28 | |
| 29 | @interface RecursiveClass : RecursiveClass // expected-error {{trying to recursively use 'RecursiveClass' as superclass of 'RecursiveClass'}} |
| 30 | @end |
| 31 | |
| 32 | @implementation RecursiveClass |
| 33 | @end |
| 34 | |
Douglas Gregor | 95ff742 | 2010-01-04 17:27:12 +0000 | [diff] [blame] | 35 | @implementation iNTF3 // expected-warning{{cannot find interface declaration for 'iNTF3'; did you mean 'INTF3'?}} |
| 36 | @end |