GDC bug: link error with cross-module templated AA member function call
H. S. Teoh
hsteoh at quickfur.ath.cx
Wed Feb 15 11:01:48 PST 2012
I've found a bug in GDC; just wanted to check on the forum to see if the
bug has already been reported. Here's the minimal test case:
----abc.d----
int[string] map;
void func(bool B)(string x) {
map.get(x, 0);
}
----test.d----
import std.stdio;
import abc;
void main() {
func!true("abc");
}
The linker complains (in encrypted Klingon ;-)) that it can't find
map.get():
$ gdc-4.6 *.d
/tmp/ccprmf4H.o: In function `_D3abc12__T4funcVb1Z4funcFAyaZv':
test.d:(.text._D3abc12__T4funcVb1Z4funcFAyaZv[_D3abc12__T4funcVb1Z4funcFAyaZv]+0x54): undefined reference to `_D6object28__T16AssociativeArrayTAyaTiZ16AssociativeArray3getMFAyaLiZi'
collect2: ld returned 1 exit status
$ gdc-4.6 --version
gdc-4.6 (Debian 4.6.2-4) 4.6.2
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The problem doesn't happen if the compile-time argument to func() is
removed, or if map and func is put in the same module as main(). It
doesn't happen if map[x] is used instead of map.get(x,0).
It seems that something is being overlooked when instantiating a
template imported from another module that references an AA method.
This problem doesn't happen with dmd.
T
--
Curiosity kills the cat. Moral: don't be the cat.
More information about the Digitalmars-d
mailing list