October 15, 2017 [Issue 17899] New: Cannot initialise contextless delegate at compile time | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=17899 Issue ID: 17899 Summary: Cannot initialise contextless delegate at compile time Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: iamthewilsonator@hotmail.com module foo; void delegate() bar = (){}; complains about requiring a context for the initialisation that is unavailable at compile time. The assignment to bar (and all delegates) at compile time has no context (can only refer to [thread local] globals by value) and so should compile with the context pointer = null. This would remove the necessity for module constructors to do the assignment. It would also solve https://github.com/libmir/dcompute/issues/32 where the module constructors fail to initialise the delegates properly, which is a separate issue that I haven't been able to pin down (not yet reported). -- |
Copyright © 1999-2021 by the D Language Foundation