https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88312

            Bug ID: 88312
           Summary: [9 regression] Mishandled explicitly provided
                    parameter pack
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: m.cencora at gmail dot com
  Target Milestone: ---

Following program fails to compile with latest gcc, while it compiles with gcc
8 and earlier, and with clang as well.

#include <type_traits>
#include <utility>

template <std::size_t N, typename ...Ts>
struct nth_type
{
private:   
    template <typename ...Vs, typename Head, typename ...Tail>
    static Head call2(Vs..., Head, Tail...);

    template <std::size_t ...Ints, typename ...Us>
    static auto call(std::index_sequence<Ints...>, Us... us)
        -> decltype(call2<decltype(Ints)...>(us...));

public:
    using type = decltype(call(std::make_index_sequence<N>(), Ts{}...));
};

template <std::size_t N, typename ...Ts>
using  nth_type_t = typename nth_type<N, Ts...>::type;

static_assert(std::is_same<nth_type_t<0, float, bool, char>, float>());
static_assert(std::is_same<nth_type_t<1, float, bool, char>, bool>());
static_assert(std::is_same<nth_type_t<2, float, bool, char>, char>());

Reply via email to