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

            Bug ID: 77435
           Summary: Dependent reference non-type template parameter not
                    matched for partial specialization
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ed at catmur dot co.uk
  Target Milestone: ---

template<int, class T, T> struct S;
template<class T, T A> struct S<0, T, A> {};
int i;
S<0, int*, &i> r;  // OK
S<0, int&, i> s;  // error: aggregate 'S<0, int&, i> s' has incomplete type

Clang, MSVC accept this.

I can't find anything in [temp.deduct] that would be cause to consider the
partial specialization non-matching.

Workaround is to add a more specialized partial specialization for reference
types:

template<class T, T& A> struct S<0, T&, A> {};

If instead I add a partial specialization for reference non-type parameters,
gcc accepts but clang and MSVC consider ambiguous:

template<class T, T& A> struct S<0, T, A> {};

Reply via email to