OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [objc.dg/] [lookup-1.m] - Blame information for rev 315

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 309 jeremybenn
/* { dg-do run } */
2
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
3
 
4
#include <stdlib.h>
5
#include "../objc-obj-c++-shared/Object1.h"
6
 
7
typedef struct MyWidget {
8
  int a;
9
} MyWidget;
10
 
11
MyWidget gWidget = { 17 };
12
 
13
@protocol MyProto
14
- (MyWidget *)widget;
15
@end
16
 
17
@interface Foo: Object
18
@end
19
 
20
@interface Bar: Foo <MyProto>
21
@end
22
 
23
@interface Container: Object
24
+ (MyWidget *)elementForView:(Foo *)view;
25
@end
26
 
27
@implementation Foo
28
@end
29
 
30
@implementation Bar
31
- (MyWidget *)widget {
32
  return &gWidget;
33
}
34
@end
35
 
36
@implementation Container
37
+ (MyWidget *)elementForView:(Foo *)view
38
{
39
  MyWidget *widget = (MyWidget *) nil;
40
  if ([view conformsTo:@protocol(MyProto)]) {
41
    widget = [(Foo <MyProto> *)view widget];
42
  }
43
  return widget;
44
}
45
@end
46
 
47
int main(void) {
48
  id view = [Bar new];
49
  MyWidget *w = [Container elementForView: view];
50
 
51
  if (!w || w->a != 17)
52
    abort ();
53
 
54
  return 0;
55
}
56
 
57
#include "../objc-obj-c++-shared/Object1-implementation.h"

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.