brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · a86dc63 Raw
85 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s2 3void takevoidptr(void*);4 5 6@interface Foo7- iMethod;8+ cMethod;9@end10 11@interface A12+ superClassMethod;13- (void)instanceMethod;14@end15 16@interface B : A17- (void)instanceMethod;18+ classMethod;19@end20 21@implementation B22 23- (void)instanceMethod {24  [super iMethod]; // expected-warning{{'A' may not respond to 'iMethod'}}25  26  // Use of super in a block is ok and does codegen to the right thing.27  takevoidptr(^{28    [super instanceMethod];29  });30}31 32+ classMethod {33  [super cMethod]; // expected-warning{{method '+cMethod' not found (return type defaults to 'id')}}34  35  id X[] = { [ super superClassMethod] };36  id Y[] = {37    [ super.superClassMethod iMethod],38    super.superClassMethod,39    (id)super.superClassMethod  // not a cast of super40  };41  return 0;42}43@end44 45@interface XX46- m;47@end48 49void f(id super) {50  [super m];51}52void f0(int super) {53  [super m]; // expected-warning{{receiver type 'int' is not 'id'}}54}55void f1(id puper) {  // expected-note {{'puper' declared here}}56  [super m]; // expected-error{{use of undeclared identifier 'super'}}57}58 59typedef Foo super;60 61typedef Foo FooTD;62 63void test(void) {64  [FooTD cMethod];65  [super cMethod];66}67 68struct SomeStruct {69  int X;70};71 72int test2(void) {73  struct SomeStruct super = { 0 };74  return super.X;75}76 77int test3(void) {78  id super = 0;79  [(B*)super instanceMethod];80  int *s1 = (int*)super;81  82  id X[] = { [ super superClassMethod] };83  return 0;84}85