1 // PR c++/89767
2 // { dg-do compile { target c++14 } }
3 // { dg-options "-O2 -Wall" }
4 
5 template <typename d> struct e { using g = d; };
6 template <typename d, template <typename> class> using h = e<d>;
7 template <typename d, template <typename> class i>
8 using j = typename h<d, i>::g;
9 template <typename c> int k(c);
10 template <typename...> class au;
11 struct l { template <typename c> using m = typename c::f; };
12 struct s : l { using af = j<au<int, int> *, m>; };
13 template <unsigned long, typename> struct o;
14 template <long p, typename c> using q = typename o<p, c>::g;
15 template <typename> struct r;
16 template <typename c> struct r<c *> { typedef c aj; };
17 template <typename ak, typename> struct al { typename r<ak>::aj operator*(); void operator++(); };
18 template <typename am, typename an, typename ao>
19 bool operator!=(al<am, ao>, al<an, ao>);
20 template <unsigned long, typename...> struct ap;
21 template <unsigned long aq, typename ar, typename... as>
22 struct ap<aq, ar, as...> : ap<1, as...> {};
23 template <unsigned long aq, typename ar> struct ap<aq, ar> {};
24 template <typename... at> class au : public ap<0, at...> {};
25 template <unsigned long p, typename ar, typename... as>
26 struct o<p, au<ar, as...>> : o<p - 1, au<as...>> {};
27 template <typename ar, typename... as> struct o<0, au<ar, as...>> { typedef ar g; };
28 template <long p, typename ar> constexpr ar av(ap<p, ar> __t) { return ar (); }
29 template <int p, typename... at> constexpr q<p, au<at...>> aw(au<at...> __t) { av<p>(__t); return q<p, au<at...>> (); }
30 struct bg { typedef s::af af; };
31 struct F { typedef al<bg::af, int> bk; bk begin(); bk end(); };
32 void bo() { int t = 0; F cv; for (auto bp : cv) [t, n = k(aw<1>(bp))] {}; }
33