www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20814] New: Fail to compile with scope - what is reason for

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

          Issue ID: 20814
           Summary: Fail to compile with scope - what is reason for
                    restriction?
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: apz28 hotmail.com

Fail with message "Error: no size because of forward references"

    struct S
    {
        alias D = void delegate(scope ref S value);

        int v;
        D dg;        
    }

Remove 'scope' and it is fine

    struct S
    {
        alias D = void delegate(ref S value);

        int v;
        D dg;        
    }

--
May 09 2020