www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - DMD 0.100 template/function pointer bug.

the folowing fails to compile. 
I can not see why fp.init can not be the erf function !!

--------------------------- dt03.d ----------------
template Dyn( T ) {
	T require() {
		return T.init; // this appears to be the offending
line of code
	}
}

void erf() {  }
typedef void function ( ) fp = &erf;
alias Dyn!( fp ) dynFunc; // this line causes the error to appear

// if you compile this 0.97..0.100+ you get this error
// dmd -c dt03.d
//dt03.d(10): cannot implicitly convert expression &erf of type
void(*)() to fp
Aug 22 2004