"bearophile" <bearophileh...@lycos.com> a écrit dans le message de news: iht0ha$2avd$1...@digitalmars.com... > This D2 code: > > import std.math: sqrt; > void main() { > double sqrt(); > double result = sqrt(9.0); > } > > Generates the errors: > test.d(4): Error: function test.main.sqrt () is not callable using > argument types (double) > test.d(4): Error: expected 0 arguments, not 1 for non-variadic function > type double() >
--- This one compiles, but does not link: import std.math: sqrt; void main() { double sqrt(double x); double result = sqrt(9.0); } --- And this one compiles and links ok. import std.math: sqrt; void main() { double sqrt(double x) { return 1.0; } double result = sqrt(9.0); } So, with the appropriate prototype it compiles, but there is a conflict with the sqrt() already defined in Phobos.