digitalmars.D.bugs - [Issue 21464] New: Superfluous module-level import affects attribute
- d-bugmail puremagic.com (43/43) Dec 09 2020 https://issues.dlang.org/show_bug.cgi?id=21464
https://issues.dlang.org/show_bug.cgi?id=21464 Issue ID: 21464 Summary: Superfluous module-level import affects attribute inference 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) { ~this() { import std.experimental.allocator : dispose; char[] elements = null; Allocator.instance.dispose(elements); } } void main() { import std.experimental.allocator.mallocator : Mallocator; Vector!Mallocator ret; static assert(ret.__dtor.mangleof == "_D3bug__T6VectorTS3std12experimental9allocator10mallocator10MallocatorZQCk6__dtorMFNbNiZv"); } ``` The non-Bug version works with DMD 2.077+, the Bug version fails since DMD 2.080. [The real-world symptom was an undefined-symbol linker error...] --
Dec 09 2020