[Issue 776] New: Unittest section inside a template does not alway execute.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 30 06:04:22 PST 2006


http://d.puremagic.com/issues/show_bug.cgi?id=776

           Summary: Unittest section inside a template does not alway
                    execute.
           Product: D
           Version: 0.178
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: pchapin at ecet.vtc.edu


Consider the following two file program:

----> main.d <----

import other;

int main( )
{
  Foo!(int) my_foo = new Foo!(int);
  return( 0 );
}

----> other.d <----

class Foo(T) {
  unittest {
    assert( 1 == 0 );
  }
};

When compiled with 'dmd -unittest main.d other.d' the program compiles and
links without error. However, the unit test does not execute (or at least the
assertion does not fire). Moving the class template Foo(T) into main.d and
throwing away other.d *does* cause the assertion to fire.


-- 



More information about the Digitalmars-d-bugs mailing list