1 // PR c++/57543
2 // { dg-do compile { target c++11 } }
3 
4 template< typename > struct X
5 {
6   void foo();
7   auto bar() -> decltype( X::foo() );
8 };
9 
10 template< typename > struct Y
11 {
12   void foo();
13   template< typename >
14   auto bar() -> decltype( Y::foo() );
15 };
16 
17 template< typename > struct Z
18 {
19   void foo();
20   template< typename T >
21   auto bar() -> decltype( T::foo() );
22 };
23 
24 template< typename > struct K
25 {
26   void foo();
27   template< typename T >
28   auto bar() -> decltype( T::foo() );
29 };
30 
31 template<>
32 template<>
33 auto K<int>::bar<K<int>>() -> decltype( K<int>::foo() );
34 
main()35 int main()
36 {
37   X<int>().bar();
38   Y<int>().bar<double>();
39   Z<int>().bar<Z<int>>();
40   K<int>().bar<K<int>>();
41 }
42