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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.law/] [arm15.C] - Blame information for rev 699

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do run  }
2
// GROUPS passed ARM-compliance
3
// arm file
4
// From: Johan Bengtsson 
5
// Date:     Thu, 21 Oct 93 16:10:25 +0100
6
// Subject:  gcc 2.4.5 initializes base classes in mem-initializer order
7
// Message-ID: <9310211510.AA14943@holden.lulea.trab.se>
8
 
9
#include 
10
#include 
11
 
12
int state = 0;
13
 
14
class A { public:
15
        A() {
16
                if (state == 0)
17
                        state = 1;
18
                else {
19
                        printf ("FAIL\n");
20
                        exit (1);
21
                }
22
        }
23
};
24
 
25
class B { public:
26
        B() {
27
                if (state == 1)
28
                        state = 2;
29
                else {
30
                        printf ("FAIL\n");
31
                        exit (1);
32
                }
33
        }
34
};
35
 
36
class AB : public A, public B { public:
37
        AB() : B(), A() {
38
                if (state == 2)
39
                        state = 3;
40
                else {
41
                        printf ("FAIL\n");
42
                        exit (1);
43
                }
44
        }
45
};
46
 
47
int main()
48
{
49
        AB ab;
50
        if (state == 3)
51
                printf("PASS\n");
52
        else
53
                printf("FAIL\n");
54
        exit (state != 3);
55
}

powered by: WebSVN 2.1.0

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