July 13, 2004 [repost from digitalmars.D] Compiler bug? Trying to compile unit tests inside template class. | ||||
---|---|---|---|---|
| ||||
[Originally posted to digitalmars.D, but reposted to digitalmars.D.bugs]
Hi All,
If I compile the following files (file1.d and file2.d) and execute the
resultant executable, the test doesn't run (see results). Is this
intentional, or a bug? If I merge the two into one file, then the test
runs.
==== begin file1.d ====
import file2;
int main(char[][] args)
{
TemplateA!(int).A a;
return 0;
}
==== end file1.d ====
==== begin file2.d ====
template TemplateA(TYPEA)
{
class A
{
public:
unittest
{
printf("test\n");
assert(1==1);
}
}
}
==== end file2.d ====
==== begin results ====
[dhbayne@localhost dbug]$ dmd file1.d file2.d -unittest
gcc file1.o file2.o -o file1 -lphobos -lpthread -lm
[dhbayne@localhost dbug]$ ./file1
[dhbayne@localhost dbug]$
==== end results ====
--
+-----------------------------------------------------------------+
| Duncan Bayne phone (+64) 027 2536395 email dhbayne@ihug.co.nz |
| ============ icq# 115621676 msn dhbayne@hotmail.com |
| |
| web http://homepages.ihug.co.nz/~dhbayne/ |
| http://groups.yahoo.com/group/akl_airsoft/ |
| http://groups.yahoo.com/group/wakeup_nz/ |
+-----------------------------------------------------------------+
| "The ultimate result of shielding men from the effects of folly |
| is to fill the world with fools." |
| |
| - Herbert Spencer. |
+-----------------------------------------------------------------+
|
July 14, 2004 Re: [repost from digitalmars.D] Compiler bug? Trying to compile unit tests inside template class. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Duncan Bayne | Looks like a bug. |
Copyright © 1999-2021 by the D Language Foundation