[Issue 3486] New: [tdpl] Incorrect result type of binary operators applied to typedef'd types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 7 10:11:11 PST 2009


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

           Summary: [tdpl] Incorrect result type of binary operators
                    applied to typedef'd types
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrei at metalanguage.com


--- Comment #0 from Andrei Alexandrescu <andrei at metalanguage.com> 2009-11-07 10:11:09 PST ---
unittest {
    Mass m;
    Velocity v;
    pragma(msg, typeof(m * v).stringof);
    pragma(msg, typeof(v * m).stringof);
    static assert(is(typeof(m * v) == double));
    static assert(is(typeof(v * m) == double));
}

Currently the type of m * v is Velocity, and the type of v * m is Mass. The
only reasonable type of an operation (if it compiles at all) should be double,
obtained after both operands are converted to their supertype.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list