[Issue 5153] Struct pointer to struct variable assign error message

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Apr 28 05:01:08 PDT 2014


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

Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com,
                   |                            |k.hara.pg at gmail.com

--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> ---
It's not a wrong diagnostic, but maybe it can be improved somehow. The issue is
that after construction the compiler will attempt another construction. E.g.:

-----
struct Foo
{
    this(Foo* x_) { }
    this(int x_) { }
}

void main()
{
    // calls two ctors
    Foo f = new Foo(0);
}
-----

Maybe this can be considered dangerous behavior. I'll CC Kenji for thoughts.

--


More information about the Digitalmars-d-bugs mailing list