www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21467] New: Imported modules/packages are inaccessible


          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 puremagic.com
          Reporter: maxsamukha 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

Dec 10 2020