1 // Origin c++/45558 2 // { dg-do compile } 3 4 template <typename S, typename T> 5 struct C 6 { 7 template <typename U> 8 struct B 9 { 10 template <typename W> 11 struct E 12 { EC::B::E13 explicit E(const W &x) : w(x) {} 14 const W &w; 15 }; 16 }; 17 }; 18 19 struct F; 20 template <typename X> 21 struct D 22 { DD23 D() {} 24 }; 25 26 const D<F> g; 27 template <typename S, typename T> 28 struct A 29 { 30 template <typename U> 31 struct B : C<S, T>::template B<U> 32 { 33 typedef typename C<S, T>::template B<U> V; 34 static const D<typename V::template E<D<F> > > a; 35 }; 36 }; 37 38 template <typename S, typename T> 39 template <typename U> 40 const D<typename C<S, T>::template B<U>::template E<D<F> > > 41 A<S, T>::B<U>::a = typename C<S, T>::template B<U>::template E<D<F> >(g); 42