www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23032] New: passing nested structs to struct templates which


          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

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;

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

Apr 17 2022