[Issue 13296] New: User defined types matches typed template rather than aliased as best match

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Aug 15 06:02:43 PDT 2014


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

          Issue ID: 13296
           Summary: User defined types matches typed template rather than
                    aliased as best match
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: simendsjo at gmail.com

This is a change in master.
I find the new behavior more consistent and better than the previous, but it
might be a regression rather than a bugfix (by bugzilla-fu isn't very good).

In 2.065, passing a user-defined type would match an alias parameter before a
type parameter. See the following example.

The following code prints
2.065: T int, alias S
2.066: T int, T S

    template t(T) {
        pragma(msg, "T ", T.stringof);
        alias t = T;
    }

    template t(alias T) {
        pragma(msg, "alias ", T.stringof);
        alias t = T;
    }

    void main() {
        struct S {}
        t!int i; // 2.065: T,     2.066: T
        t!S s;   // 2.065: alias, 2.066: T
    }

--


More information about the Digitalmars-d-bugs mailing list