[Issue 7061] delegates sometimes cannot be used in struct initializers

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jul 1 20:37:34 PDT 2017


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

--- Comment #2 from timon.gehr at gmx.ch ---
(In reply to Vladimir Panteleev from comment #1)
> Timon, fairly sure that's not the entire program. What's the definition of S?

Oops. Thanks! The entire program:

struct S{ void delegate() dg; }
struct T{ int delegate() dg; }

int x;
S a = {{}};              // fail
S b = {{;}};             // fail
S c = {{x=0;}};          // fail
T d = {{return 0;}};     // fail

void main(){
    S x = {{}};          // ok
    S y = {{;}};         // fail
    S z = {{x=0;}};      // fail
    T w = {{return 0;}}; // fail
}

--


More information about the Digitalmars-d-bugs mailing list