view gcc/testsuite/g++.dg/cpp0x/nullptr17.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// { dg-do compile { target c++11 } }

// Used to test that bool is a better overload match than int
// Updated for DR 1423

template <typename T, typename U> struct tType_equal;
template <typename T> struct tType_equal<T, T> { typedef void type; };

template <typename T, typename U>
inline typename tType_equal<T, U>::type
type_equal(U) { }

int i( int );
long int i( long int );
bool i( bool );

void test_i()
{
  // Overload to bool, not int
  type_equal<bool>(i(nullptr));  // { dg-error "direct" }
  decltype(nullptr) mynull = 0;
  type_equal<bool>(i(mynull));   // { dg-error "direct" }
}