Bug 19400 – Very brittle undefined symbol linker failure when importing modules

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-11-14T06:36:04Z
Last change time
2020-04-05T07:14:11Z
Assigned to
No Owner
Creator
Nathan S.

Attachments

IDFilenameSummaryContent-TypeSize
1717bug.zipdemonstrates the bugapplication/zip1274

Comments

Comment #0 by n8sh.secondary — 2018-11-14T06:36:04Z
Created attachment 1717 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; } ---
Comment #1 by n8sh.secondary — 2018-11-14T06:43:47Z
"in b" -> "in bug1.o"
Comment #2 by n8sh.secondary — 2020-04-05T07:14:11Z
Closed invalid: not a bug.