June 07, 2020 [Issue 20905] New: An alias inside a static if results in an undefined identifier in some situations | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20905 Issue ID: 20905 Summary: An alias inside a static if results in an undefined identifier in some situations Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: kytodragon@e.mail.de This code: struct Bar { Foo foo; } static if (true) { alias my_type = ushort; } struct Foo { my_type index; } results in this error: test.d(11): Error: undefined identifier `my_type` Removing Bar or moving Bar after the static if fixes it. This also happens, if Bar is defined in another file and imported into the one with the static if. Reproduced on Windows x64 with DMD 2.092.0 and LDC 1.21.0. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply