www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21922] New: rdmd linker error with simple import structure

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

          Issue ID: 21922
           Summary: rdmd linker error with simple import structure
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: tools
          Assignee: nobody puremagic.com
          Reporter: bmqawsed4 gmail.com

See code below. rdmd main.d fails with 'Error 42 Undefined Symbol'.
Unexpectedly,removing the comment around import B in main removes issue at cost
of widening scope.

// main
void main() {
   import A;
// import B;
   import std.stdio;

   writeln("Entered main");

   fnA1();

   writeln("Leaving main");
}

module A;

void fnA1() {

   import B;
   import std.stdio;

   writeln("Entered fnA1");
   fnB1();
   writeln("Leaving fnA1");
}

module B;

void fnB1() {

   import std.stdio;

   writeln("Entered fnB1");
   writeln("Leaving fnB1");   
}

--
May 15 2021