[Issue 24045] New: Compiler fails to recognize overlapping Union elements in CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 13 13:27:25 UTC 2023


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

          Issue ID: 24045
           Summary: Compiler fails to recognize overlapping Union elements
                    in CTFE
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: puneet at coverify.org

enum bool bar = foo(42);

bool foo(ubyte c) {
  union U {
    uint a;
    ubyte[4] b;
  }
  U u;
  u.b[0] = c;
  assert (u.a == c, "This should never happen");
  return true;
}

--


More information about the Digitalmars-d-bugs mailing list