view gcc/testsuite/g++.dg/template/dependent-name14.C @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
line wrap: on
line source

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

namespace test {
    void EXISTS(int);
}

template<typename... ARGS>
struct stub_void {
    typedef void type;
};
template<typename... ARGS>
using stub_void_t = typename stub_void<ARGS...>::type;

#if !defined(SUPPRESS)
template<typename O, typename = void>
struct has_to_string {
    static constexpr bool value = false;
};

template<typename O>
struct has_to_string<O, stub_void_t<decltype(EXISTS(O{}))>> {
    static constexpr bool value = true;
};
#endif

template<typename O, typename = void>
struct has_std_to_string {
    static constexpr bool value = false;
};

template<typename O>
struct has_std_to_string<O, stub_void_t<decltype(test::EXISTS(O{}))>> {
    static constexpr bool value = true;
};

static_assert (has_std_to_string<int>::value, "");