www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12929] New: Empty union followed by field causes ICE due to

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

          Issue ID: 12929
           Summary: Empty union followed by field causes ICE due to offset
                    of 0.
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Keywords: ice, ice-on-valid-code
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: opantm2+dbugs gmail.com

Sample:

struct Foo {
    union { }
    int bar;
}

Output:
dmd: argtypes.c:405: virtual void
toArgTypes(Type*)::ToArgTypes::visit(TypeStruct*): Assertion `t1 || f->offset
== 0' failed.
Aborted (core dumped)


While the above example is fairly useless seeming, it makes more sense with
variable length templates to generate a union.

--
Jun 16 2014