[Issue 14420] partial template ordering with specialization and different arities seems broken

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Apr 7 08:06:50 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14420

Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Martin Nowak from comment #0)
> void foo(string op:"+", T)(ref T val, T mod)
> 
> void foo(string op, T, V1)(ref T val, V1 mod)
> ---

"Partial specialization order" is defined only when two templates have same
template parameters except for TemplateTypeParameterSpecialization. For
example:

  template A(string op,     T) {}   // A1
  template A(string op:"+", T) {}   // A2 is a specialized version of A1

But in the OP code, Two 'foo's have different number of parameters, so neither
of them is not a specialized version of one another.

Therefore the ambiguous error is correct result.

--


More information about the Digitalmars-d-bugs mailing list