http://d.puremagic.com/issues/show_bug.cgi?id=10831
Summary: using typeid in CTFE in imported file adds link
dependency when generating debug info
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Rainer Schuetze <[email protected]> 2013-08-15 23:42:26
PDT ---
Considering two modules test.d and imp.d:
//////////////////////////
module test;
import imp.d;
void main() {}
/////////////////////////
module imp;
struct S { int x = 2; }
static assert(typeid(S));
/////////////////////////
Compile with "dmd test.d" works fine.
However building with debug information "dmd -g test.d" yields:
OPTLINK (R) for Win32 Release 8.00.13
Copyright (C) Digital Mars 1989-2010 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
test.obj(test)
Error 42: Symbol Undefined _D3imp1S6__initZ
--- errorlevel 1
The same happens with type inference:
/////////////////////////
module imp;
struct S { int x = 2; }
auto ti = typeid(S);
/////////////////////////
This is caused by some operations adding TypeInfo instances to the object file
that reference the static initializer of a type. This initializer is only
generated with the type declaration, though. The normal link strips the COMDAT
with the TypeInfo, but the debug info is not split per COMDAT, so it drags the
offending symbol back in.
Some more operations that implicitely use typeid and probably exhibit this
behaviour when executed during CTFE aswell:
- struct postblit and dtor
- array.dup and idup
- array.sort
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------