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

            Bug ID: 88162
           Summary: GCC does not accept non-type template parameters of
                    class type
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tiagomacarios at gmail dot com
  Target Milestone: ---

Looking at http://eel.is/c++draft/temp.arg.nontype I would think that the code
below is C++17 complaint.

GCC thinks this is only available in 2a mode. clang compiles it fine in c++17
mode.

https://godbolt.org/z/PGoXwX

template<class T> struct id
{
    using type = T;
};

template<auto X, template<auto> class T> id<decltype(X)> f( T<X> )
{
};

constexpr struct zero_type
{
    template<class T> constexpr operator T () const { return {}; }
} zero;

template<template<auto> class T> using nttp_t = typename decltype( f(T<zero>())
)::type;

template <int> struct int_constant {};
template <char> struct char_constant {};
template <long> struct long_constant {};
template <void*> struct voidp_constant {};

void g( nttp_t<int_constant>, nttp_t<char_constant>, nttp_t<long_constant>,
nttp_t<voidp_constant> )
{
}

Reply via email to