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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.dg/] [init/] [array5.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// { dg-do run }
2
// Copyright (C) 2002 Free Software Foundation
3
// Contributed by Kriang Lerdsuwanakij 
4
 
5
// Incorrect construction and destruction of multi-dimensional
6
// array of class.
7
 
8
extern "C" void abort();
9
extern "C" int printf(const char *, ...);
10
 
11
int count;
12
int num;
13
 
14
struct A
15
{
16
        A()
17
        {
18
                if (count == num)
19
                        throw "";
20
                count++;
21
#ifdef PRINT
22
                printf("ctor %p\n", static_cast(this));
23
#endif
24
        }
25
 
26
        ~A()
27
        {
28
                count--;
29
#ifdef PRINT
30
                printf("dtor %p\n", static_cast(this));
31
#endif
32
        }
33
};
34
 
35
struct Array
36
{
37
        A array[2][2][2];
38
};
39
 
40
int main()
41
{
42
        for (num = 0; num <= 8; ++num) {
43
                count = 0;
44
                try {
45
                        Array A;
46
                }
47
                catch (...) {
48
                }
49
                if (count != 0)
50
                        abort();
51
        }
52
}

powered by: WebSVN 2.1.0

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