blob: 26718ae2eaa109b4c42b1d43f106821de476c6b9 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Andy Gibbs8e8fb3b2012-10-19 12:44:48 +00002// expected-no-diagnostics
Steve Naroffd8df6822008-12-18 15:50:41 +00003@protocol NSObject
4- retain;
5- release;
6@end
7
8@interface NSObject
9- init;
10- dealloc;
11@end
12
13@protocol Foo <NSObject>
14@end
15
16@protocol Bar <Foo>
17@end
18
19@interface Baz : NSObject {
20 id <Foo> _foo;
21 id <Bar> _bar;
22}
23- (id)initWithFoo:(id <Foo>)foo bar:(id <Bar>)bar;
24@end
25
26@implementation Baz
27
28- (id)init
29{
30 return [self initWithFoo:0 bar:0];
31}
32
33- (id)initWithFoo:(id <Foo>)foo bar:(id <Bar>)bar
34{
35 self = [super init];
36 if (self != 0) {
37 _foo = [foo retain];
38 _bar = [bar retain];
39 }
40 return self;
41}
42
Fariborz Jahanianb33f3ad2009-05-01 20:07:12 +000043- dealloc
Steve Naroffd8df6822008-12-18 15:50:41 +000044{
45 [_foo release];
46 [_bar release];
47 [super dealloc];
Mike Stumpd1969d82009-07-22 00:43:08 +000048 return 0;
Steve Naroffd8df6822008-12-18 15:50:41 +000049}
50
51@end
52