www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5779] New: Bad value range propagation for ternary operator

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: thecybershadow gmail.com



---
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: -------
Mar 23 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5779


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au




 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).
D1 doesn't have range propagation! It's a D2 feature, which eliminates these kind of nonsense errors. I think this bug is probably invalid. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 23 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5779


Vladimir <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID



---
Oops :) You're probably right.

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