www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24666] New: Two modules, mutually importing each other,

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

          Issue ID: 24666
           Summary: Two modules, mutually importing each other, silently
                    ignores bodies of static conditions
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: feklushkin.denis gmail.com

Two modules, mutually importing each other, silently ignores bodies of static
conditions:

p1/m1.d:
    module p1.m1;

    import p2.m2; // if commented out then code works as expected

    //alias A = int; // will work if uncomment and comment out next code:

    static if(true)
        alias A = int; // declaration will be ignored

p2/m2.d:
    module p2.m2;

    import p1.m1: A;

main.d:
    import p1.m1;

    void main()
    {
        A a;
    }

Compilation:

ldc2 -c -I. main.d
p2/m2.d(3): Error: module `p1.m1` import `A` not found

--
Jul 17