www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19306] New: Explicit struct constructors aren't smart when

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 puremagic.com
          Reporter: b2.temp 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
}

--
Oct 14 2018