111
|
1 // { dg-do compile { target c++11 } }
|
|
2
|
|
3
|
|
4 // Test template deduction
|
|
5
|
|
6 template <typename T, typename U> struct tType_equal;
|
|
7 template <typename T> struct tType_equal<T, T> { typedef void type; };
|
|
8
|
|
9 template <typename T, typename U>
|
|
10 inline typename tType_equal<T, U>::type
|
|
11 type_equal(U) { }
|
|
12
|
|
13 template<typename T> T* g( T* t ); // { dg-message "note" }
|
|
14
|
|
15 void test_g()
|
|
16 {
|
|
17 // Deduction to nullptr_t, no deduction to pointer type
|
|
18 //
|
|
19 g(nullptr); // { dg-error "no matching function for call to " }
|
|
20 // { dg-message "(candidate|mismatched types)" "candidate note" { target *-*-* } .-1 }
|
|
21 type_equal<float*>(g((float*)nullptr));
|
|
22 decltype(nullptr) mynull = 0;
|
|
23 g(mynull); // { dg-error "no matching function for call to " }
|
|
24 // { dg-message "(candidate|mismatched types)" "candidate note" { target *-*-* } .-1 }
|
|
25 type_equal<float*>(g((float*)mynull));
|
|
26 }
|