digitalmars.D.bugs - [Issue 17968] New: object initializer for auto function not included
- d-bugmail puremagic.com (47/47) Nov 05 2017 https://issues.dlang.org/show_bug.cgi?id=17968
https://issues.dlang.org/show_bug.cgi?id=17968 Issue ID: 17968 Summary: object initializer for auto function not included when seen through 2 libraries Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: link-failure Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: schveiguy yahoo.com I need to reduce this more. But I can't figure out easily what the trigger is. It has something to do with the auto return. Just wanting to put a bug in place so it's not forgotten. Here is the gist of the situation: I have one library that depends on another. In the first library I have a function like so: auto openDev(int fd) { return ioObject(File(fd)); } ioObject is from another library that looks like this: IOObject!IO ioObject(IO)(IO io) { return new IOObject!IO(io.move); } Where IOObject is a templated class. In a program I am compiling, I have a statement that uses openDev(0). If I compile this, I get a missing symbol, which is this: _D50TypeInfo_xC3std2io__T8IOObjectTSQvQt4file4FileZQBa6__initZ This is the initializer for the IOObject!File, that the ioObject is instantiating. However, it is never instantiated in either library. If I change the auto return to returning IOObject!File, it links and compiles. At that point, the object file of the executable (not either of the libraries) *defines* the symbol (in one case, nm says the symbol is undefined, in the successful case, it says it's defined). I'm not sure what the difference is, but clearly it should define it either way, it shouldn't look to the libraries to define it. I tried reducing to a simple 2-library solution with some simplified code. This did not exhibit the problem. The libraries in question don't compile on anything earlier than 2.076.0, so I am going to work around these issues to see if this ever worked. --
Nov 05 2017