Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Douglas Gregor | 7dda67d | 2009-02-05 19:25:20 +0000 | [diff] [blame] | 2 | @protocol NSObject |
| 3 | - retain; |
| 4 | - release; |
| 5 | @end |
| 6 | |
| 7 | @interface NSObject |
| 8 | - init; |
| 9 | - dealloc; |
| 10 | @end |
| 11 | |
| 12 | @protocol Foo <NSObject> |
| 13 | @end |
| 14 | |
| 15 | @protocol Bar <Foo> |
| 16 | @end |
| 17 | |
| 18 | @interface Baz : NSObject { |
| 19 | id <Foo> _foo; |
| 20 | id <Bar> _bar; |
| 21 | } |
| 22 | - (id)initWithFoo:(id <Foo>)foo bar:(id <Bar>)bar; |
| 23 | @end |
| 24 | |
| 25 | @implementation Baz |
| 26 | |
| 27 | - (id)init |
| 28 | { |
| 29 | return [self initWithFoo:0 bar:0]; |
| 30 | } |
| 31 | |
| 32 | - (id)initWithFoo:(id <Foo>)foo bar:(id <Bar>)bar |
| 33 | { |
| 34 | self = [super init]; |
| 35 | if (self != 0) { |
| 36 | _foo = [foo retain]; |
| 37 | _bar = [bar retain]; |
| 38 | } |
| 39 | return self; |
| 40 | } |
| 41 | |
Fariborz Jahanian | b33f3ad | 2009-05-01 20:07:12 +0000 | [diff] [blame^] | 42 | - dealloc |
Douglas Gregor | 7dda67d | 2009-02-05 19:25:20 +0000 | [diff] [blame] | 43 | { |
| 44 | [_foo release]; |
| 45 | [_bar release]; |
| 46 | [super dealloc]; |
| 47 | } |
| 48 | |
| 49 | @end |
| 50 | |