digitalmars.D.bugs - [Issue 19400] New: Very brittle undefined symbol linker failure when
- d-bugmail puremagic.com (57/57) Nov 13 2018 https://issues.dlang.org/show_bug.cgi?id=19400
https://issues.dlang.org/show_bug.cgi?id=19400 Issue ID: 19400 Summary: Very brittle undefined symbol linker failure when importing modules Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: n8sh.secondary hotmail.com Created attachment 1717 --> https://issues.dlang.org/attachment.cgi?id=1717&action=edit demonstrates the bug Attached is a test demonstrating the bug. The following works: `dmd bug1.d includes/bug2.d`. The following fails in linking: `dmd bug1.d -I=./includes`. The error message is: Undefined symbols for architecture x86_64: "__D6object__T8__equalsTxC6ObjectTxQkZQyFAxQsQeZb", referenced from: __D4bug2__T5DummySQp__T6StructTvZQk3fooMFiZ9__lambda2ZQBr11__xopEqualsFKxSQCt__TQCrSQDd__TQCpTvZQCvQCmMFiZQClZQDvKxQBqZb in b The source code split between two files is: --- bug1.d module bug1; import bug2 : Struct; size_t foo(ref Struct!void e) { return cast(size_t) &e; } void main() { } --- includes/bug2.d module bug2; private struct Dummy(alias pred) { bool hasAny; private Object[] _; // Compilation succeeds if you remove this. } struct Struct(Unused) { bool foo(int f) { return Dummy!(a => a == f).init.hasAny; } private Object[] _; // Compilation succeeds if you remove this. } private struct Unused2 { Struct!void x; } --- --
Nov 13 2018