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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [template-8.mm] - Blame information for rev 703

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 703 jeremybenn
/* Test that all pending instantiations have taken place before meta-data
2
   generation. */
3
/* Author: Fariborz Jahanian  */
4
/* Adapted by Nicola Pero  */
5
/* { dg-do run } */
6
/* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
7
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
8
 
9
#include 
10
#include 
11
 
12
@interface MyRootClass
13
{ Class isa; }
14
+ (id) initialize;
15
+ alloc;
16
- init;
17
- doSomething;
18
@end
19
 
20
@implementation MyRootClass
21
+ (id) initialize { return self; }
22
+ alloc { return class_createInstance (self, 0); }
23
- init  { return self; }
24
- doSomething { return self; }
25
@end
26
 
27
class Base
28
{
29
public:
30
        Base() { }
31
        virtual ~Base() { }
32
 
33
        void destroy() { delete this; }
34
};
35
 
36
template
37
class Subclass : public T
38
{
39
public:
40
        Subclass() { }
41
 
42
        virtual ~Subclass()
43
        {
44
                [[[MyRootClass alloc] init] doSomething];
45
        }
46
};
47
 
48
int main(int argc, const char * argv[])
49
{
50
    Subclass* theSubclass = new Subclass();
51
    theSubclass->destroy();
52
    return 0;
53
}

powered by: WebSVN 2.1.0

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