[Issue 1659] template alias parameters are chosen over all but exact matches.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 3 14:04:26 PDT 2009


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





------- Comment #2 from gide at nwawudu.com  2009-04-03 16:04 -------
Including original attachment in this comments. Issue looks similar to BUG 918.

import std.stdio;

typedef char ctd;
class Foo { }
class Bar : Foo { }

void main()
{
    Baz!(char)(); /* regular template version used only because
                   * template alias parameters reject basic types. */
    Baz!(ctd)(); // alias version used
    Baz!(Foo)(); // Foo version used
    Baz!(Bar)(); // alias version used
}

void Baz(T)()
{
    writefln("regular template version called with ", T.stringof);
}

void Baz(T : Foo)()
{
    writefln("foo specialization called with ", T.stringof);
}

void Baz(alias T)()
{
    writefln("alias version called with ", T.stringof);
}


-- 



More information about the Digitalmars-d-bugs mailing list