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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.robertl/] [eh990323-1.C] - Blame information for rev 154

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

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do run  }
2
// check cleanup of template temporaries
3
extern "C" void abort ();
4
extern "C" void exit (int);
5
 
6
int ctor = 0;
7
int dtor = 0;
8
 
9
template  struct A {
10
        A() {ctor++;}
11
        A(int) {ctor++;}
12
        A(const A&) {ctor++;}
13
        ~A() {dtor++;}
14
        operator int() {return 0;}
15
};
16
 
17
template  void ff(T);
18
 
19
template  void ff(T)
20
{
21
}
22
 
23
void g(int)
24
{
25
}
26
 
27
void f()
28
{
29
        int x;
30
 
31
        A a1;
32
        A a2(37);
33
        A a3 = A(47);
34
        A a4 = 97;
35
 
36
        g(A());
37
 
38
        A();
39
 
40
        x ? A() : A();
41
 
42
        x = 47, A(), A(39), A(23), -17;
43
 
44
        while (A())
45
                ;
46
        for (;A(3);)
47
                ;
48
        if (A >())
49
                ;
50
 
51
        ff(A());
52
 
53
        throw 59;
54
}
55
 
56
int
57
main()
58
{
59
        int flag = 0;
60
 
61
        try {
62
                A();
63
                f();
64
        }
65
        catch (int) {
66
                A(34);
67
                flag = 1;
68
        }
69
 
70
        if (!flag)
71
                abort();
72
 
73
        if (!ctor || ctor != dtor)
74
                abort();
75
 
76
        exit(0);
77
}

powered by: WebSVN 2.1.0

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