[Issue 21467] New: Imported modules/packages are inaccessible outside the importing module

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 10 17:00:37 UTC 2020


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

          Issue ID: 21467
           Summary: Imported modules/packages are inaccessible outside the
                    importing module
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: maxsamukha at gmail.com

module b;

template member(alias s, string m) {
    static assert(__traits(hasMember, s, m)); // passes for both x and b
    alias member = mixin("s.", m); // fails for b 
}
----

module a;

import b;

int x;
alias x1 = member!(a, "x"); // ok

alias b1 = a.b; // ok
alias b2 = member!(a, "b"); // fail

void main() {
}
----

source/b.d-mixin-5(5,1): Error: undefined identifier b in module a
source/a.d(9,12): Error: template instance b.member!(a, "b") error
instantiating

--


More information about the Digitalmars-d-bugs mailing list