www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21464] New: Superfluous module-level import affects attribute


          Issue ID: 21464
           Summary: Superfluous module-level import affects attribute
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kinke gmx.net

Compiling the following with `-version=Bug` shows that the superfluous import
leads to `pure` being wrongly inferred for the Vector destructor:

module bug;

version (Bug)
    import std.experimental.allocator.mallocator : Mallocator;

struct Vector(Allocator)
        import std.experimental.allocator : dispose;
        char[] elements = null;

void main()
    import std.experimental.allocator.mallocator : Mallocator;
    Vector!Mallocator ret;
    static assert(ret.__dtor.mangleof ==

The non-Bug version works with DMD 2.077+, the Bug version fails since DMD

[The real-world symptom was an undefined-symbol linker error...]

Dec 09 2020