www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22348] New: Specify forward referencing of MixinDeclaration

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

          Issue ID: 22348
           Summary: Specify forward referencing of MixinDeclaration
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dlang.org
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

To https://dlang.org/spec/module.html#MixinDeclaration, add two paragraphs:

"The content of a mixin cannot be forward referenced by other DeclDefs of the
same scope because it is not yet pulled in the AST"

```
class B : A {}
mixin ("class A {}");
```

"forward references may only work in function bodies because they are processed
after the declarations"

```
void v()
{
    class B : A {}
}
mixin ("class A {}");
```

--
Oct 02 2021