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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [lookup-2.mm] - Blame information for rev 720

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

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

powered by: WebSVN 2.1.0

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