Templates accessed via interface won't link
Status: Alpha
Brought to you by:
dvdfrdmn
The following code fails to link:
Undefined symbols:
"__D5test213TestInterface10__T3tplTiZ3tplMFZv", referenced from:
__Dmain in test.o
The code:
interface TestInterface
{
void tpl(T)();
}
class TestImplementation : TestInterface
{
void tpl(T)()
{
}
}
void main()
{
/* TestImplementation t = new TestImplementation(); // works */
TestInterface t = new TestImplementation(); // fails
t.tpl!(int)();
}
I'm using i686-apple-darwin8-gdc-4.0.1. It's unaffected by -femit-templates switch.
Logged In: YES
user_id=1378044
Originator: NO
The sample code is actually invalid and the compiler should be reporting an error. (Virtual template member functions are not allowed.)
I have opened a bug against the DMD front end: http://d.puremagic.com/issues/show_bug.cgi?id=2015