diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/decltype59.C')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/decltype59.C | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype59.C b/gcc/testsuite/g++.dg/cpp0x/decltype59.C new file mode 100644 index 00000000000..93208df95cb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype59.C @@ -0,0 +1,41 @@ +// PR c++/57543 +// { dg-do compile { target c++11 } } + +template< typename > struct X +{ + void foo(); + auto bar() -> decltype( X::foo() ); +}; + +template< typename > struct Y +{ + void foo(); + template< typename > + auto bar() -> decltype( Y::foo() ); +}; + +template< typename > struct Z +{ + void foo(); + template< typename T > + auto bar() -> decltype( T::foo() ); +}; + +template< typename > struct K +{ + void foo(); + template< typename T > + auto bar() -> decltype( T::foo() ); +}; + +template<> +template<> +auto K<int>::bar<K<int>>() -> decltype( K<int>::foo() ); + +int main() +{ + X<int>().bar(); + Y<int>().bar<double>(); + Z<int>().bar<Z<int>>(); + K<int>().bar<K<int>>(); +} |