November 13 [Issue 24857] New: Unknown error while instantiating: __traits(compiles) hides the real issue | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24857 Issue ID: 24857 Summary: Unknown error while instantiating: __traits(compiles) hides the real issue Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: ilya.yanok@gmail.com dustmite minimized example (probably could be minimized a bit further): ``` template AllMembersInModule(alias Module) { import std: AliasSeq, Filter; alias all_members = AliasSeq!(__traits(allMembers, Module)); template CanAccess(string member) { enum CanAccess = __traits(compiles, __traits(getMember, Module, member)); } alias x = Filter!(CanAccess, all_members); alias AllMembersInModule = y; } template t() { alias MODULE = __traits(parent, {}); static foreach (M; AllMembersInModule!MODULE) { } } alias AllMembers = AllMembersInModule!(__traits(parent, {})); mixin t; ``` The issue here is a typo: `y` should be `x`, but we get an unknown error instead. If I remove `alias AllMembers` it works as expected. BTW, if I remove `mixin t` line, it compiles without error, is it expected, are aliases lazy? -- |
Copyright © 1999-2021 by the D Language Foundation