1 // PR c++/53574
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-fstack-usage" }
4
5 template <typename> struct A { typedef int type; };
6 struct B {
7 typedef __SIZE_TYPE__ H;
8 };
9 template <typename> class allocator : B {};
10 template <typename _Alloc> struct C {
11 template <typename T>
12 static typename T::H foo(T *);
13 typedef decltype(foo((_Alloc *)0)) H;
14 template <typename U>
barC15 static typename A<H>::type bar(U) { return typename A<H>::type (); }
bazC16 static int baz(_Alloc p1) { bar(p1); return 0; }
17 };
18 template <typename _Alloc> struct I : C<_Alloc> {};
19 template <typename, typename> struct J {
20 typedef I<allocator<int>> K;
21 K k;
22 };
23 struct D : J<int, allocator<int>> {
fnD24 void fn(int, int) {
25 K m;
26 I<K>::baz(m);
27 }
28 };
29 template <class Ch, class = int, class = int> struct F {
30 F();
31 F(const Ch *);
32 F test();
33 D d;
34 };
35 int l;
36 struct G {
37 G(F<char>);
38 };
39 char n;
F(const Ch *)40 template <class Ch, class Tr, class Alloc> F<Ch, Tr, Alloc>::F(const Ch *) {
41 test();
42 }
43 template <class Ch, class Tr, class Alloc>
test()44 F<Ch, Tr, Alloc> F<Ch, Tr, Alloc>::test() {
45 d.fn(l, 0);
46 return F<Ch, Tr, Alloc> ();
47 }
fn1()48 G fn1() { return G(&n); }
49