brintos

brintos / llvm-project-archived public Read only

0
0
Text · 858 B · e8abf6c Raw
57 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify %s2@protocol NSObject3- retain;4- release;5@end6 7@interface NSObject8- init;9- dealloc;10@end11 12@protocol Foo <NSObject>13@end14 15@protocol Bar <Foo>16@end17 18@interface Baz : NSObject {19	id <Foo> _foo;20	id <Bar> _bar;21}22- (id)initWithFoo:(id <Foo>)foo bar:(id <Bar>)bar;23@end24 25@implementation Baz26 27- (id)init28{29	return [self initWithFoo:0 bar:0];30}31 32- (id)initWithFoo:(id <Foo>)foo bar:(id <Bar>)bar33{34	self = [super init];35	if (self != 0) {36		_foo = [foo retain];37		_bar = [bar retain];38	}39	return self;40}41 42- dealloc43{44	[_foo release];45	[_bar release];46	[super dealloc];47	return 0;48}49 50@end51 52void rdar8575095(id a) {53  [id<NSObject>(a) retain];54  id<NSObject> x(id<NSObject>(0));55  id<NSObject> x2(id<NSObject>(y)); // expected-warning{{disambiguated as a function declaration}} expected-note{{add a pair of parentheses}}56}57