On Friday, 10 June 2016 at 13:17:32 UTC, Steven Schveighoffer
wrote:
On 6/10/16 8:04 AM, Chris wrote:
I get the error below with code like this:
auto res = ['1', '2'].map!(a => a.to!string);
dmd 2.071.0
What's wrong here? I import std.algorithm, std.range,
std.array,
std.conv in the module.
(.data._D65TypeInfo_xC3std5range10interfaces18__T10InputRangeTiZ10InputRange6__initZ+0x10):
undefined reference to
`_D64TypeInfo_C3std5range10interfaces18__T10InputRangeTiZ10InputRange6__initZ'
collect2: error: ld returned 1 exit status
This linker error is saying it can't find a required typeinfo
initializer for std.range.interfaces.InputRange (of some type,
not an expert in demangling D symbols).
Generally this happens when you compile against a third-party
library file but don't link to it (I think that type of symbol
is stored in the module info).
Your posted code has nothing to do with this, so I'm not sure
this is the exact line you are having trouble with. Your posted
map line should not be invoking this error at all.
Have you tried Vladimir's DustMite tool? It can automatically
whittle down your code into a minimal test case.
https://github.com/CyberShadow/DustMite/wiki
-Steve
I've got it now. I remembered that it is to do with passing
-allinst to the compiler.
You're right, it's not `map!` as such. It's the template
instantiation. However, the problem only appeared when I started
to use `map!`