[Issue 10635] Error: cannot use array to initialize S

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 26 00:49:36 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=10635


Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid


--- Comment #4 from Kenji Hara <k.hara.pg at gmail.com> 2013-11-26 00:49:31 PST ---
https://github.com/D-Programming-Language/dmd/pull/2882

>From issue 7019, at least following code should work via "implicit constructor
call" feature.

struct S
{
    string str;
    this(string[] v) { str = v[0]; }
    this(string[string] v) { str = v.keys[0]; }
}
S s1 = ["str"];         // should work
S s2 = ["str" : "val"]; // should work

But, 'static opCall' is an old workaround against constructors, and I don't
think we should extend the case it workable. So my pull request does not
support the OP code.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list