Bug 776 – Unittest section inside a template does not alway execute.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2006-12-30T08:04:00Z
Last change time
2014-02-15T13:21:09Z
Assigned to
bugzilla
Creator
pchapin

Comments

Comment #0 by pchapin — 2006-12-30T08:04:22Z
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.
Comment #1 by thomas-dloop — 2006-12-31T08:47:27Z
Comment #2 by thomas-dloop — 2007-04-27T12:27:17Z
fixed in DMD-1.005