digitalmars.D.bugs - [Issue 23032] New: passing nested structs to struct templates which
- d-bugmail puremagic.com (36/36) Apr 17 2022 https://issues.dlang.org/show_bug.cgi?id=23032
https://issues.dlang.org/show_bug.cgi?id=23032 Issue ID: 23032 Summary: passing nested structs to struct templates which make them static should be a warning Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: crazymonkyyy gmail.com ```d import std; struct framelaundering(FRAME){ static FRAME main; ref i(){return main.j;} } void main(){ int i; struct here{ ref j(){return i;} } framelaundering!here foo; foo.i++; i.writeln; } ``` causes a runtime crash; whats happening to the otherwise magic static keyword was extremely unclear to me. Id suggest a warning "here from main.here has a context pointer, when its used in framelaundering!here.main is initialed without it because its static" or sometin --
Apr 17 2022