www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16403] New: wrong "matches more than one template

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

          Issue ID: 16403
           Summary: wrong "matches more than one template declaration"
                    error with template specialization on alias parameters
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ag0aep6g gmail.com

----
struct S(T) {}

/* This should work, but fails: */

enum fails(alias Tmpl, alias Inst : Tmpl!A, A) = true;
enum fails(alias Tmpl, alias Inst) = false;
static assert(fails!(S, S!int)); /* Error: template test.fails matches more
than one template declaration */

/* These variations work: */

enum works1(alias Inst : S!A, A) = true;
enum works1(alias Inst) = false;
static assert(works1!(S!int)); /* passes */

enum works2(alias Tmpl, Inst : Tmpl!A, A) = true;
enum works2(alias Tmpl, Inst) = false;
static assert(works2!(S, S!int)); /* passes */
----

--
Aug 18 2016