import std.stdio; struct Temp { this(float ctorPar) { } this(double ctorPar) { } void buggy(float val) const { writeln(val); } void buggy2(double val) const { writeln(val); } void working(real val) const { writeln(val); } } void main() { Temp(7.f).buggy(2.); //!<- val == ctorPar Temp(7.f).buggy2(0.); //!<- val is some mixup of ctorPar Temp(7.f).working(2.); Temp(7.).buggy(2.); //!<- val == 0 Temp(7.).buggy2(2.); //!<- val == ctorPar Temp(7.).working(2.); } ------ Only the functions taking a real gets called with the correct parameter value. The other two are influenced by the value to the ctor.
https://github.com/D-Programming-Language/dmd/commit/3b9f611336d3d2ba9d68fb8949d70b8a0417f31e https://github.com/D-Programming-Language/dmd/commit/479fb8254a8a3bfb15ff4dee0bcd575fd6acbc5c
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル