Bug 17112 – Simple writeln call produces cryptic error message

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Mac OS X
Creation time
2017-01-22T06:12:36Z
Last change time
2018-07-01T19:58:15Z
Keywords
diagnostic
Assigned to
No Owner
Creator
Gillett

Comments

Comment #0 by naclypi — 2017-01-22T06:12:36Z
some working example code: $ dmd --version DMD64 D Compiler v2.072.2 Copyright (c) 1999-2016 by Digital Mars written by Walter Bright $ dmd degenerate.d Undefined symbols for architecture x86_64: "_D3std6format18__T10FormatSpecTaZ10FormatSpec6fillUpMFNaZv", referenced from: _D3std6format18__T10FormatSpecTaZ10FormatSpec63__T17writeUpToNextSpecTS3std5array17__T8AppenderTAyaZ8AppenderZ17writeUpToNextSpecMFNaS3std5array17__T8AppenderTAyaZ8AppenderZb in degenerate.o _D3std6format18__T10FormatSpecTaZ10FormatSpec59__T17writeUpToNextSpecTS3std5stdio4File17LockingTextWriterZ17writeUpToNextSpecMFS3std5stdio4File17LockingTextWriterZb in degenerate.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: linker exited with status 1 -----------------<degenerate.d>------------------ import std.stdio; void main(){ writeln(["string1", "string2"]); } ------------------------------------------------- a more realistic example which causes the same error: -----------------<realistic.d>------------------- import std.stdio; // for writeln import std.algorithm; // for map import std.conv; // for to!string import std.range; // for iota string[] substrings(string n) { // returns a "sliding window" array of substrings of n return iota(1,8).map!(i => n[i..(i+3)]).array; } void main(){ int[] n = [0,1,2,3,4,5,6,7,8,9]; writeln(n.map!(to!string).join.substrings); // <------------ this line causes the error writeln(n.map!(to!string).join.substrings.join(",")); // <-- this would be the fix } ------------------------------------------------- i think this is a regression because this error was not happening before i updated dmd to v2.072.2.
Comment #1 by naclypi — 2017-01-22T06:14:57Z
issue 16661 - https://issues.dlang.org/show_bug.cgi?id=16661 - seemed to have the same error but in a different form. it was the only issue i found that had a similar error message after searching around for a bit
Comment #2 by nick — 2018-07-01T19:58:15Z
This works with dmd-nightly on run.dlang.io.