Problem with unittest in templates.
Thomas Kuehne
thomas-dloop at kuehne.cn
Fri Dec 29 08:01:24 PST 2006
Peter C. Chapin <pchapin at sover.net> schrieb:
> Hello! I'm using dmd 0.178. I'm having trouble getting the unittest
> section of a class template to execute. I have two files:
>
> ----> main.d <----
>
> import other;
>
> int main( )
> {
> Foo!(int) my_foo = new Foo!(int);
> return( 0 );
> }
>
> ----> other.d <----
>
> class Foo(T) {
> unittest {
> assert( 1 == 0 );
> }
> };
>
> I compile this program using 'dmd -unittest main.d other.d'. It compiles
> without error but when it executes there is no assertion failure.
> However, if I move the definition of class Foo(T) into main.d (and throw
> away other.d) I *do* get the assertion failure. Am I doing something
> wrong? Is this supposed to work?
Please file a bug report:
http://d.puremagic.com/issues
Thomas
More information about the Digitalmars-d-learn
mailing list