digitalmars.D - Compiler bug? Trying to compile unit tests inside template class.
- Duncan Bayne (47/47) Jul 13 2004 Hi All,
- Duncan Bayne (16/23) Jul 13 2004 I've reposted this 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 |
| |
| 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. |
+-----------------------------------------------------------------+
Jul 13 2004
Duncan Bayne wrote: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. <snip>I've reposted this to digitalmars.D.bugs. -- +-----------------------------------------------------------------+ | Duncan Bayne phone (+64) 027 2536395 email dhbayne ihug.co.nz | | | | 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. | +-----------------------------------------------------------------+
Jul 13 2004








Duncan Bayne <dhbayne ihug.co.nz>