Bug 19625 – [Reg 2.067] module-level static template struct can't take alias to a delegate

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-01-28T18:10:17Z
Last change time
2024-12-13T19:02:15Z
Assigned to
No Owner
Creator
John Colvin
Moved to GitHub: dmd#17895 →

Comments

Comment #0 by john.loughran.colvin — 2019-01-28T18:10:17Z
static struct S(alias f) { int foo() { return f(); } } void main() { int a; int b = S!(() => a)().foo; } Error: function onlineapp.main.S!(delegate () => a).S.foo cannot access frame of function D main Removing the `static` causes it to compile fine, but why does static do anything at module scope? I tried to read the docs but they didn't say much on the topic. This was fixed in https://github.com/dlang/dmd/pull/2794 and then broken again in the revert https://github.com/dlang/dmd/pull/3884/
Comment #1 by robert.schadek — 2024-12-13T19:02:15Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17895 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB