summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.jason/static1.C
blob: 2c6f6bd4da149cf69dc8e38bf3524862a5bf3992 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// { dg-do run  }
// PRMS id: 6863

extern "C" int printf(const char *, ...);
extern "C" void abort();

enum ENUM {E1=0, E2 };
int d;

class AAA{
public:
 AAA() {a = new char[10];printf("constructor AAA() called\n");}
 AAA(int) {printf("constructor AAA(int) called\n");}
 ~AAA(){ printf("destructor ~AAA() called\n"); d = 1; }
 operator int () { return 1;}
 char *a;
 int i;
};

struct sentinel {
  ~sentinel () { if (d == 0) abort (); }
} s;

/* forward decl here causes gcc not to execute ct and dt for arr1 */
extern AAA arr1[];

AAA arr1[] = {(int)E1 };

int main()
{
  return 0;
}