[Issue 13945] Documentation and errors of nested structs need improvement

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 3 23:29:40 PDT 2015


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

Ali Cehreli <acehreli at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |acehreli at yahoo.com

--- Comment #1 from Ali Cehreli <acehreli at yahoo.com> ---
Found another example that does not involve a nested struct:

import std.algorithm;

struct Foo(R)
{
    R r;

    this(R r)    // <-- Compilation error
    {}
}

auto foo(R)(R r)
{
    return Foo!R(r);
}

void main()
{
    [1].map!(i => i).foo;
}

Error: field r must be initialized in constructor, because it is nested struct

Ali

--


More information about the Digitalmars-d-bugs mailing list