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

            Bug ID: 83426
           Summary: template argument involves template parameters with
                    implicit integral conversion
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: r...@klipp-lischner.net
  Target Milestone: ---

Created attachment 42884
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42884&action=edit
Minimal compilable demonstration

[temp.class.spec] par 8.1 says "A partially specialized non-type argument
expression shall not involve a template parameter of the
partial specialization except when the argument expression is a simple
identifier."

But the following fails to compile:

template<char T, unsigned char...>
struct fail : std::false_type {};

template<char T, unsigned char... Rest>
struct fail<T, '0', T, Rest...> : std::true_type {};

with the error:

template argument '(unsigned char)T' involves template parameter(s)

But the argument expression is a simple identifier. The standard italicizes
identifier, highlighting the fact that it refers to a syntactic entity.

The problem is the implicit integral conversion from char to unsigned char.
Changing the type of of the parameter pack from unsigned char to char causes
the example to compile.

Although the standard is silent about implicit type conversions and promotions
in this case, the use of the syntactic entity 'identifier' implies (to me, at
least), that the restriction is syntactic, not semantic.

Reply via email to