[Issue 13226] New: Symbol is not accessible when using traits or mixin

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jul 30 07:24:43 PDT 2014


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

          Issue ID: 13226
           Summary: Symbol is not accessible when using traits or mixin
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: kozzi11 at gmail.com

Created attachment 1374
  --> https://issues.dlang.org/attachment.cgi?id=1374&action=edit
source code example

//main.d:

import m.f;
class A {
    //class main.A member m is not accessible
    //mixin(t!(typeof(this), "m"));
    void m() {};
    //here is ok
    //mixin(t!(typeof(this), "m"));
}
void main(string[] args){}

//m.f
module m.f;
string t(alias cls, string method)() {
    import std.traits;
    static if (isSomeFunction!(__traits(getMember, cls, method))) 
{}
    return "";
}

But when I put content from m.f into main.d everything works ok. 
Or even when I change __traits(getMember, cls, method) to cls.m 
everything works. It also does not work with mixin (mixin("cls.m"))

--


More information about the Digitalmars-d-bugs mailing list