view gcc/testsuite/g++.dg/cpp0x/sfinae51.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

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

struct HasIter {
   typedef int * const_iterator;
};

struct NoIter {
};

template <typename T>
constexpr bool foo(const T &, typename T::const_iterator *)
{
  return true;
}

template <typename T>
constexpr bool foo(const T &, ...)
{
  return false;
}

HasIter has_iter;
NoIter no_iter;

static_assert (!foo(no_iter, 0), "");
static_assert (foo(has_iter, 0), "");
static_assert (foo<HasIter>(has_iter, 0), "");