PR c++/86728 - C variadic generic lambda.
[official-gcc.git] / gcc / testsuite / g++.dg / init / array5.C
blobaeacb31cfaa141c78f63c875ffe8f8ad4b1c84a2
1 // { dg-do run }
2 // Copyright (C) 2002 Free Software Foundation
3 // Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
5 // Incorrect construction and destruction of multi-dimensional
6 // array of class.
8 extern "C" void abort();
9 extern "C" int printf(const char *, ...);
11 int count;
12 int num;
14 struct A
16         A()
17         {
18                 if (count == num)
19                         throw "";
20                 count++;
21 #ifdef PRINT
22                 printf("ctor %p\n", static_cast<void *>(this));
23 #endif
24         }
26         ~A()
27         {
28                 count--;
29 #ifdef PRINT
30                 printf("dtor %p\n", static_cast<void *>(this));
31 #endif
32         }
35 struct Array
37         A array[2][2][2];
40 int main()
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         }