This is D2 code: static foo() { return 1.0; } enum double x = foo(); // line 4 void main() {} dmd v2.045 shows at compile time: test.d(4): Error: forward reference to foo The error message is wrong in two ways: - It doesn't show the error of the missing return type of foo at line 1 - There is a forward reference error that D isn't supposed to generate here
The static without return type implies "auto". This is a variation of bug 2810, and the patch there also fixes this testcase. *** This issue has been marked as a duplicate of issue 2810 ***