[Issue 2025] New: Inconsistent rules for instantiating templates with a tuple parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 22 23:01:07 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2025

           Summary: Inconsistent rules for instantiating templates with a
                    tuple parameter
           Product: D
           Version: 2.012
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: samukha at voliacable.com


The template with non-tuple parameter is preferred if that parameter is a value
(Case 1). The template with tuple parameter is preferred if the non-tuple
parameter is a type (Case 2).

Case 1
----
template Foo(int i)
{
    pragma(msg, "One");
}

template Foo(A...)
{
    pragma(msg, "Many");
}

alias Foo!(1) foo;
----
Outputs: One

Case 2
----
template Foo(T)
{
    pragma(msg, "One");
}

template Foo(A...)
{
    pragma(msg, "Many");
}

alias Foo!(int) foo;
----
Outputs: Many

Probably both cases should result in an ambiguity error.


-- 



More information about the Digitalmars-d-bugs mailing list