Bug 12729 – mixins don't work in traits

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2014-05-10T16:17:01Z
Last change time
2020-03-21T03:56:40Z
Assigned to
No Owner
Creator
Vlad Levenfeld

Comments

Comment #0 by vlevenfeld — 2014-05-10T16:17:01Z
const bool has_attribute (T, string member, alias attribute) () { // ok mixin( `foreach (type; __traits (getAttributes, T.`~member~`))` `static if (is (type == attribute))` `return true;` ); // ok foreach (type; mixin(`__traits (getAttributes, T.`~member~`)`)) static if (is (type == attribute)) return true; // doesn't compile, member is not accessible error foreach (type; __traits (getAttributes, mixin(`T.`~member))) static if (is (type == attribute)) return true; return false; }
Comment #1 by monarchdodra — 2014-05-10T19:16:02Z
Could you provide the use case that triggers the error? I can't reproduce it.
Comment #2 by vlevenfeld — 2014-05-22T20:24:05Z
my apologies, I didn't understand how the mailing system worked at the time that I posted this and only now saw your comment - the use case has since been thoroughly paved over.
Comment #3 by monarchdodra — 2014-05-22T21:18:22Z
(In reply to Vlad Levenfeld from comment #2) > the use case has since been thoroughly paved over. Hum... Well, if we can't reproduce the issue, we'll have to close this.
Comment #4 by b2.temp — 2019-02-13T04:03:23Z
not resolvable as is