| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
|
| 3 |
// Used to test that bool is a better overload match than int |
| 4 |
// Updated for DR 1423 |
| 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 |
int i( int ); |
| 14 |
long int i( long int ); |
| 15 |
bool i( bool ); |
| 16 |
|
| 17 |
void test_i() |
| 18 |
{ |
| 19 |
// Overload to bool, not int |
| 20 |
type_equal<bool>(i(nullptr)); // { dg-error "direct" } |
| 21 |
decltype(nullptr) mynull = 0; |
| 22 |
type_equal<bool>(i(mynull)); // { dg-error "direct" } |
| 23 |
} |