OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [g++.dg/] [init/] [array5.C] - Diff between revs 301 and 384

Only display areas with differences | Details | Blame | View Log

Rev 301 Rev 384
// { dg-do run }
// { dg-do run }
// Copyright (C) 2002 Free Software Foundation
// Copyright (C) 2002 Free Software Foundation
// Contributed by Kriang Lerdsuwanakij 
// Contributed by Kriang Lerdsuwanakij 
// Incorrect construction and destruction of multi-dimensional
// Incorrect construction and destruction of multi-dimensional
// array of class.
// array of class.
extern "C" void abort();
extern "C" void abort();
extern "C" int printf(const char *, ...);
extern "C" int printf(const char *, ...);
int count;
int count;
int num;
int num;
struct A
struct A
{
{
        A()
        A()
        {
        {
                if (count == num)
                if (count == num)
                        throw "";
                        throw "";
                count++;
                count++;
#ifdef PRINT
#ifdef PRINT
                printf("ctor %p\n", static_cast(this));
                printf("ctor %p\n", static_cast(this));
#endif
#endif
        }
        }
        ~A()
        ~A()
        {
        {
                count--;
                count--;
#ifdef PRINT
#ifdef PRINT
                printf("dtor %p\n", static_cast(this));
                printf("dtor %p\n", static_cast(this));
#endif
#endif
        }
        }
};
};
struct Array
struct Array
{
{
        A array[2][2][2];
        A array[2][2][2];
};
};
int main()
int main()
{
{
        for (num = 0; num <= 8; ++num) {
        for (num = 0; num <= 8; ++num) {
                count = 0;
                count = 0;
                try {
                try {
                        Array A;
                        Array A;
                }
                }
                catch (...) {
                catch (...) {
                }
                }
                if (count != 0)
                if (count != 0)
                        abort();
                        abort();
        }
        }
}
}
 
 

powered by: WebSVN 2.1.0

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