[PR c++/84702] ICE with default tmpl arg of overload set
[official-gcc.git] / gcc / testsuite / g++.dg / ext / complit12.C
blob5c6a731f9ac29c6700076628c972093b5fcaa4ce
1 // PR c++/40948
2 // { dg-do run }
3 // { dg-options "" }
5 int c;
6 struct M
8   M () { ++c; }
9   M (const M&) { ++c; }
10   ~M () { --c; }
13 struct S
15   S ();
16   M m[1];
19 S::S () : m ((M[1]) { M () })
23 struct T
25   T ();
26   M m[4];
29 T::T () : m ((M[4]) { M (), M (), M (), M () })
33 typedef M MA[1];
34 MA &bar (MA, MA& r) { return r; }
36 M f(M m) { return m; }
38 int main ()
40   {
41     M m[1] = (M[1]) { M () };
42     if (c != 1)
43       return 1;
44     M n = (M) { M () };
45     if (c != 2)
46       return 2;
47     M o[4] = (M[4]) { M (), M (), M (), M () };
48     if (c != 6)
49       return 3;
50     S s;
51     if (c != 7)
52       return 4;
53     T t;
54     if (c != 11)
55       return 5;
56     M mm[2] = ((M[2]) { f(M()), f(M()) });
57     if (c != 13)
58       return 8;
59 #if 0
60     MA ma = bar ((M[2]) { M(), M() }, m);
61     if (c != 14)
62       return 7;
63 #endif
64   }
65   if (c != 0)
66     return 6;