1471 – Linker error on template function. Error 42: Symbol Undefined ...

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1471 - Linker error on template function. Error 42: Symbol Undefined ...
Summary: Linker error on template function. Error 42: Symbol Undefined ...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: link-failure, patch
: 5062 (view as issue list)
Depends on:
Blocks:
Reported: 2007年09月04日 01:02 UTC by Chad
Modified: 2015年06月09日 05:11 UTC (History)
4 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Chad 2007年09月04日 01:02:34 UTC
void explode(char[] foo)()
{
 int gremlins;
 char[] bar = foo[gremlins..$];
}
void main(){ explode!("BOOM"); }
The above program prints the following when compiled:
C:\dmd\bin\..\..\dm\bin\link.exe main,,,user32+kernel32/noi;
OPTLINK (R) for Win32 Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved
main.obj(main)
 Error 42: Symbol Undefined _D4main27__T7explodeVG4aa4_424f4f4dZ7explodeFZv8__do
llark
--- errorlevel 1
This was tested with DMD 1.020 on Windows XP.
Comment 1 kennytm 2011年05月08日 01:09:21 UTC
Still not fixed in D2.052 :)
-------------------------------------
void explode(string foo)() {
 int gremlins = 0;
 string bar = foo[gremlins .. $];
}
void main(){ explode!("BOOM")(); }
-------------------------------------
Undefined symbols:
 "_D1x27__T7explodeVAyaa4_424f4f4dZ7explodeFZv8__dollark", referenced from:
 _D1x27__T7explodeVAyaa4_424f4f4dZ7explodeFZv8__dollark$non_lazy_ptr in x.o
 (maybe you meant: _D1x27__T7explodeVAyaa4_424f4f4dZ7explodeFZv8__dollark$non_lazy_ptr)
ld: symbol(s) not found
collect2: ld returned 1 exit status
--- errorlevel 1
-------------------------------------
'_D1x27__T7explodeVAyaa4_424f4f4dZ7explodeFZv8__dollark' means 'void x.explode!("BOOM").explode().uint __dollar'.
Comment 2 kennytm 2011年06月30日 10:25:34 UTC
Reduced test case for 1.068:
-----------------------------------
void main(){
 const string s = "BOOM";
 int gremlins = 0;
 string bar = s[gremlins .. $];
}
-----------------------------------
Undefined symbols:
 "_D1y4mainFZv8__dollark", referenced from:
 _D1y4mainFZv8__dollark$non_lazy_ptr in y.o
 (maybe you meant: _D1y4mainFZv8__dollark$non_lazy_ptr)
ld: symbol(s) not found
collect2: ld returned 1 exit status
--- errorlevel 1
-----------------------------------
The equivalent for 2.054:
-----------------------------------
void main(){
 enum string s = "BOOM";
 int gremlins = 0;
 string bar = s[gremlins .. $];
}
-----------------------------------
Comment 3 kennytm 2011年06月30日 10:25:49 UTC
*** Issue 5062 has been marked as a duplicate of this issue. ***
Comment 4 Kenji Hara 2011年07月14日 04:24:28 UTC
D2 patch:
https://github.com/D-Programming-Language/dmd/pull/108 


AltStyle によって変換されたページ (->オリジナル) /