1 // Origin: PR c++/42915
2 // { dg-do compile }
3 
4 template <typename T>
5 class A
6 {
7   template <typename U>
8   class B
9   {
10     B foo();
11   };
12 };
13 template <typename T> template <typename U>
foo()14 A<T>::B<U> A<T>::B<U>::foo() {}
15 
16