| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
|
| 3 |
// Test template deduction |
| 4 |
|
| 5 |
typedef decltype(nullptr) nullptr_t; |
| 6 |
|
| 7 |
template <typename T, typename U> struct tType_equal; |
| 8 |
template <typename T> struct tType_equal<T, T> { typedef void type; }; |
| 9 |
|
| 10 |
template <typename T, typename U> |
| 11 |
inline typename tType_equal<T, U>::type |
| 12 |
type_equal(U) { } |
| 13 |
|
| 14 |
template<typename T> T h( T t ); |
| 15 |
|
| 16 |
void test_h() |
| 17 |
{ |
| 18 |
type_equal<int>(h(0)); |
| 19 |
type_equal<nullptr_t>(h(nullptr)); |
| 20 |
type_equal<float*>(h((float*)nullptr)); |
| 21 |
nullptr_t mynull = 0; |
| 22 |
type_equal<nullptr_t>(h(mynull)); |
| 23 |
type_equal<float*>(h((float*)mynull)); |
| 24 |
} |