Bug 14043 – Undefined reference error when compiling some functions with -inline

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-01-25T15:34:00Z
Last change time
2015-01-28T20:01:33Z
Assigned to
nobody
Creator
GenericNPC

Comments

Comment #0 by GenericNPC — 2015-01-25T15:34:40Z
When I try to call to std.stdio.File.rawRead with anything other than ubyte[] and compile with -inline, dmd complains about undefined reference to std.exception.errnoEnforce: $ cat example.d import std.stdio; void main() { byte[] buffer; File file; file.rawRead(buffer); } $ dmd -inline example.d example.o: In function `_D3std5stdio4File14__T7rawReadTgZ7rawReadMFAgZAg': example.d:(.text._D3std5stdio4File14__T7rawReadTgZ7rawReadMFAgZAg+0x17d): undefined reference to `_D3std9exception102__T12errnoEnforceTbVAyaa34_2f7573722f696e636c7564652f646c616e672f646d642f7374642f737464696f2e64Vmi717Z12errnoEnforceFNfbLAyaZb' collect2: error: ld returned 1 exit status --- errorlevel 1 Note that this only happens when I use the -inline flag and when the argument to rawRead is *not* ubyte[]. I don't think the problem is in Phobos, but in dmd that cannot instantiate templates when inlining templated functions. I've experienced this problem on dmd 2.066 and 2.066.1
Comment #1 by qctechs — 2015-01-28T20:01:33Z
*** This issue has been marked as a duplicate of issue 13172 ***