www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12596] New: Typedef(Typedef) => Typedef

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

          Issue ID: 12596
           Summary: Typedef(Typedef) => Typedef
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

void main() {
    import std.typecons;
    alias TD = Typedef!double;
    TD x = TD(1.0);
    TD y = TD(x); // Error
}


DMD 2.066alpha gives:

test.d(5,16): Error: constructor std.typecons.Typedef!(double,
nan).Typedef.this (double init) is not callable using argument types
(Typedef!(double, nan))


But I think "TD(x)" should be accepted, just like:

void main() {
    auto x = double(1);
    auto y = double(x);
}

--
Apr 19 2014