www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9617] New: ulong.max is wrongly accepted by smaller signed parameter

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9617

           Summary: ulong.max is wrongly accepted by smaller signed
                    parameter
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: k.hara.pg gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg gmail.com> 2013-02-28 17:45:44 PST ---
This is wrong implicit conversion bug.

void main()
{
    void f1(int) {}
    void f2(short) {}
    void f3(byte) {}

    // Why these calls are accepted?
    f1(ulong.max);
    f2(ulong.max);
    f3(ulong.max);

    // But, if argument is not constant value, compilation fails.
    ulong x;
    //f1(x);  // is not callable using argument types (ulong)
    //f2(x);  // is not callable using argument types (ulong)
    //f3(x);  // is not callable using argument types (ulong)

    void f4(uint) {}
    void f5(ushort) {}
    void f6(ubyte) {}

    // If parameter type is unsigned, it is collectly rejected
    //f4(ulong.max);  // is not callable using argument types (ulong)
    //f5(ulong.max);  // is not callable using argument types (ulong)
    //f6(ulong.max);  // is not callable using argument types (ulong)
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 28 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9617


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-02-28 18:16:25 PST ---
https://github.com/D-Programming-Language/dmd/pull/1704

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 28 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9617



--- Comment #2 from github-bugzilla puremagic.com 2013-02-28 23:01:28 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d224d2c1103fbe220426a6c97772dc31f5af84ea
fix Issue 9617 - ulong.max is wrongly accepted by smaller signed parameter

https://github.com/D-Programming-Language/dmd/commit/4e6a467d59169740695c25a33936d8829f1c1cb0
Merge pull request #1704 from 9rnsr/fix9617

Issue 9617 - ulong.max is wrongly accepted by smaller signed parameter

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 28 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9617


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


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