[Issue 19306] New: Explicit struct constructors aren't smart when the structs contain anonymous unions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 14 22:16:16 UTC 2018


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

          Issue ID: 19306
           Summary: Explicit struct constructors aren't smart when the
                    structs contain anonymous unions
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: b2.temp at gmx.com

struct Foo
{
    union
    {
        void delegate() a;
        void function() b;
    }
    ulong c;
}

void b(){}
struct A {void a(){}}

void main()
{
    A a;
    Foo f0 = Foo(&a.a);      // ok
    Foo f1 = Foo(&a.a, 0UL); // not allowed but should
    Foo f2 = Foo(&b, 0UL);   // not allowed but should
    Foo f3 = Foo(&b);        // not allowed but should
}

--


More information about the Digitalmars-d-bugs mailing list