May 12, 2022 [Issue 23105] New: `__trait(getMember)` and `mixin()` of the same code as a string behaves differently | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23105 Issue ID: 23105 Summary: `__trait(getMember)` and `mixin()` of the same code as a string behaves differently Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: accepts-invalid Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: b2.temp@gmx.com ``` module self; enum getMember = `__traits(getMember, sym, m)`; template test(alias sym) { static foreach (m; __traits(allMembers, sym)) { static if (is(__traits(getMember, sym, m)==module)) static assert(0); // pass static if (is(mixin(getMember)==module)) static assert(0); // fails } } void main() { alias _ = test!(self); } ``` the first static assert should fail the condition is the same as the second. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply