[Issue 1789] Template overloading doesn't work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 28 22:29:43 PDT 2008


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


bugzilla at digitalmars.com changed:

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




------- Comment #1 from bugzilla at digitalmars.com  2008-08-29 00:29 -------
That's the way it is designed to work, overloading of templates with the
template arguments overloads based on only the template argument list. You can
achieve what you wish with the following:

template pattern(T)
{
    void foo(T v) {}
    T foo() { return T.init; }
}

alias pattern!(int).foo bar;

void main() {
    pattern!(int).foo(5);

    pattern!(int).foo = 5;
    int x = pattern!(int).foo;

    bar = 5;
    int y = bar;
}


-- 



More information about the Digitalmars-d-bugs mailing list