[Issue 12477] New: std.bitmanip should emit informative diagnostics

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 26 15:50:11 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12477

           Summary: std.bitmanip should emit informative diagnostics
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2014-03-26 23:50:07 CET ---
-----
import std.bitmanip;

struct S
{
    mixin(bitfields!(
        uint, "a", 6,
        uint, "b", 10));
}

void main()
{
    S s;
    s.a = uint.max;
}
-----

$ dmd -g -run test.d

-----
core.exception.AssertError at test.d-mixin-7(8): Assertion failure
----------------
0x0040240B in _d_assert
0x0040217D in _Dmain at C:\dev\code\d_code\test.d(15)
0x00402704 in D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv
0x004026D7 in void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).runAll()
0x004025F0 in _d_run_main
0x00402198 in main
0x004189DD in mainCRTStartup
0x75803677 in BaseThreadInitThunk
0x778A9D72 in __RtlUserThreadStart
0x778A9D45 in _RtlUserThreadStart
-----

The number is out of range for the bitfield size, but the diagnostic doesn't
say that.

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


More information about the Digitalmars-d-bugs mailing list