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

            Bug ID: 70585
           Summary: Bogus 'ambiguous template instantiation' error with
                    partial specializations involving a pack expansion
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com
  Target Milestone: ---

Repro:

template<class> class meow;
template<class...> struct purr;

template<class T, class... Ts>
struct purr<T, meow<Ts>...> {};

template<class... Ts>
struct purr<int, meow<Ts>...> {};

template struct purr<int, meow<int>>;

gcc HEAD 6.0.0 20160407 (experimental) on Wandbox prints:

prog.cc:10:17: error: ambiguous template instantiation for 'struct purr<int,
meow<int> >'
 template struct purr<int, meow<int>>;
                 ^~~~~~~~~~~~~~~~~~~~
prog.cc:6:8: note: candidates are: template<class T, class ... Ts> struct
purr<T, meow<Ts>...> [with T = int; Ts = {int}]
 struct purr<T, meow<Ts>...> {};
        ^~~~~~~~~~~~~~~~~~~~
prog.cc:8:8: note:                 template<class ... Ts> struct purr<int,
meow<Ts>...> [with Ts = {int}]
 struct purr<int, meow<Ts>...> {};
        ^~~~~~~~~~~~~~~~~~~~~~
prog.cc:10:17: error: explicit instantiation of 'struct purr<int, meow<int> >'
before definition of template
 template struct purr<int, meow<int>>;
                 ^~~~~~~~~~~~~~~~~~~~

Clang compiles this code.

Reply via email to