[Issue 15554] New: typedef standard type can't be used with to! properly

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jan 11 04:30:24 PST 2016


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

          Issue ID: 15554
           Summary: typedef standard type can't be used with to! properly
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: gruen_tobias at web.de

Casting from a string to a custom Typedef type is more complicated than it
should be. To should actually care about the underlying typedef-type, and
recognize that it has to parse a string to a long value:

alias QuestionId = Typedef!(long, long.init, "QuestionId");

QuestionId q = to!(TypedefType!QuestionId)("43"); // Compiles
QuestionId q2 = to!QuestionId("43");              // Error..

Forum:
http://forum.dlang.org/thread/otcbczxfxzannjcoktfz@forum.dlang.org


togrue

--


More information about the Digitalmars-d-bugs mailing list