[Issue 5779] New: Bad value range propagation for ternary operator

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 23 21:27:23 PDT 2011


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

           Summary: Bad value range propagation for ternary operator
           Product: D
           Version: D1
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: thecybershadow at gmail.com


--- Comment #0 from Vladimir <thecybershadow at gmail.com> 2011-03-23 21:24:03 PDT ---
void main()
{
    bool b = true;
    ubyte bit = b ? 1 : 0;
}

With warnings enabled, the compiler complains:

test.d(4): Warning: implicit conversion of expression (b ? 1 : 0) of type int
to ubyte can cause loss of data

Doesn't happen with D2 (2.052).

-- 
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