www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17194] New: [scope] Fwd reference error with nested struct


          Issue ID: 17194
           Summary: [scope] Fwd reference error with nested struct
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: radu.racariu gmail.com

The following:

struct V
    W w;

    struct W
        this(scope ref V v)
            this.v = &v;
        V* v;

void main()
    V v;

Produces this:

Error: struct app.V no size because of forward reference

Expecting: to compile.

Error is also not pointing the line number the issue was suppose to be.

Work around:

1. Removing the "scope" keyword makes the program compile.

2. Changing W ctor signature to: 

this(scope V* v)
 this.v = v;

also makes it work.

Compiled with dmd 2.073.1 on win32

Feb 16 2017