www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21667] New: scope parameter causes 'no size because of

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

          Issue ID: 21667
           Summary: scope parameter causes 'no size because of forward
                    references'
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dkorpel live.nl

I changed a parameter to have the `scope` storage class, and suddenly got an
error that didn't follow from the change: "no size because of forward
references". Test case:

```
struct M
{
    F.Type f;
}

struct F
{
    enum Type {a}
    void foo(scope M m) {}
}
```

Without the `scope`, it compiles. I think the problem is that `scope` makes the
compiler check whether type M has pointers, calling `determineFields` on M,
which fails because it wants semantic analysis of F to be done for F.Type.

--
Feb 27