LDC fails to compile the following code (the contents of Struct#method are not relevant):
struct Struct {
static Struct opCall( float value ) {
Struct newStruct;
newStruct.value = value;
return newStruct;
}
Struct method() {
return *this;
}
float value;
}
template Template( float value ) {
const CONST_STRUCT = Struct( value ).method();
}
void main( char[][] args ) {
alias Template!( 1 ) foo;
}
Error message:
Main.d(18): Error: expression '(Struct(1F)).method()' is not a constant
Version info:
LLVM D Compiler based on DMD v1.045 and llvm 2.6svn (Wed May 27 00:08:12 2009)