1 // { dg-do run  }
2 // GROUPS passed constructors
3 #include <cstdio>
4 #include <cstdlib>
5 #include <iostream>
6 
7 #define MAGIC 7654
8 
9 class complex {
10         double re;
11         double im;
12         int magic;
13         static int count;
14 public:
complex()15         complex() { re=im=0; magic=MAGIC; }
complex(double d)16         complex(double d) { re=d; im=0; magic=MAGIC; }
complex(double d,double d2)17         complex(double d, double d2) {re=d; im=d2; magic=MAGIC; }
~complex()18         ~complex() {if(magic!=MAGIC) {std::printf("FAIL\n"); std::exit(1);}}
19         friend std::ostream& operator << (std::ostream& o, const complex& c)
20         { return o << "(" << c.re << "," << c.im << ")"; }
21 };
22 
23 int complex::count=0;
24 
main()25 int main()
26 {
27         complex v[6] = {1, complex(1,2), complex(), 2 }; // ARM Sect. 12.6.1
28         int i;                                           // page 289
29 
30         for(i=0; i<6; i++) ;
31 	std::printf ("PASS\n");
32 
33         return 0;
34 }
35