www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20346] New: std.uuid does not compile with checkaction=context

https://issues.dlang.org/show_bug.cgi?id=20346

          Issue ID: 20346
           Summary: std.uuid does not compile with checkaction=context
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

Reduced test case:

struct UUID
{
        union
        {
            ubyte[] data;
        }
}

unittest
{
        ubyte[] data;
        enum ctfe = UUID();
        assert(ctfe.data == data);
}

=> Error: cannot modify constant expression UUID(null).data

This is caused by _d_assert_fail taking a mutable reference to an immutable
enum member.

Ommiting the union { ... } does not trigger this error, this seems to be
another DMD bug

--
Nov 01 2019