blob: 0c072e91945aa9168a8cae51163ec6f095c55a6b [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Steve Naroff87d3ef02008-11-17 22:29:32 +00002
3@interface Foo
4- iMethod;
5+ cMethod;
6@end
7
8@interface A
9@end
10
11@interface B : A
12- (void)instanceMethod;
13+ classMethod;
14@end
15
16@implementation B
17
18- (void)instanceMethod {
Chris Lattnereb483eb2010-04-11 08:28:14 +000019 [super iMethod]; // expected-warning{{'A' may not respond to 'iMethod')}}
Steve Naroff87d3ef02008-11-17 22:29:32 +000020}
21
22+ classMethod {
23 [super cMethod]; // expected-warning{{method '+cMethod' not found (return type defaults to 'id')}}
Mike Stumpd1969d82009-07-22 00:43:08 +000024 return 0;
Steve Naroff87d3ef02008-11-17 22:29:32 +000025}
26@end
Steve Naroff5cb93b82008-11-19 15:54:23 +000027
28@interface XX
29- m;
30@end
31
32void f(id super) {
33 [super m];
34}
35void f0(int super) {
Chris Lattner4018a282009-03-11 03:47:47 +000036 [super m]; // expected-warning{{receiver type 'int' is not 'id'}} \
Chris Lattner0c73f372009-03-09 21:19:16 +000037 expected-warning {{method '-m' not found (return type defaults to 'id')}}
Steve Naroff5cb93b82008-11-19 15:54:23 +000038}
Chris Lattner15faee12010-04-12 05:38:43 +000039void f1(id puper) { // expected-note {{'puper' declared here}}
40 [super m]; // expected-error{{use of undeclared identifier 'super'; did you mean 'puper'?}}
Steve Naroff5cb93b82008-11-19 15:54:23 +000041}
Fariborz Jahaniane4fb8282010-01-22 23:04:44 +000042
43// radar 7400691
44typedef Foo super;
45
Chris Lattnereb483eb2010-04-11 08:28:14 +000046typedef Foo FooTD;
47
Fariborz Jahaniane4fb8282010-01-22 23:04:44 +000048void test() {
Chris Lattnereb483eb2010-04-11 08:28:14 +000049 [FooTD cMethod];
Fariborz Jahaniane4fb8282010-01-22 23:04:44 +000050 [super cMethod];
51}
Chris Lattner236beab2010-04-12 06:20:33 +000052
53struct SomeStruct {
54 int X;
55};
56
57int test2() {
58 struct SomeStruct super = { 0 };
59 return super.X;
60}