URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
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();
|
}
|
}
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.