[Issue 22981] Another forward reference bug involving a string mixin

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 30 16:15:40 UTC 2022


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

--- Comment #6 from Basile-z <b2.temp at gmx.com> ---
(In reply to Max Samukha from comment #5)
> I am not competent to comment on this. FWIW, attributes, which are
> conceptually similar to static members, don't have this issue:
> 
> mixin ("enum E {", __traits(getAttributes, S)[0], "}");
> 
> @("a")
> struct S
> {
>     E e;
> }
> 
> void main()
> {
> }

Nah, attribs have the same problem, it's just that your test case does not
reproduce it.

For attribs this is more like

```
mixin ("enum E {", __traits(getAttributes, S)[0], "}");

@(S.a)
struct S
{
    E e;
    enum a = "dfgdf";
}

void main()
{
}       
```

output is then the same as the original test case, i.e

> Error: undefined identifier `E`

--


More information about the Digitalmars-d-bugs mailing list