[Issue 21667] New: scope parameter causes 'no size because of forward references'

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 27 22:05:12 UTC 2021


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 at puremagic.com
          Reporter: dkorpel at 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.

--


More information about the Digitalmars-d-bugs mailing list