On Tuesday, 11 September 2012 at 21:13:02 UTC, bearophile wrote:
Namespace:
I have this code, but it works not as expected:
http://dpaste.dzfl.pl/6ce5b4dd
I suggest to file a bug:
auto foo(bool b) {
final switch (b) {
case true:
return 10;
case false:
return 20.0;
}
}
void main() {
import std.stdio: writeln;
writeln(foo(true));
writeln(foo(false));
}
The acceptable results are a compile-time error for type
mismatch, or a conversion of both literals to double. Probably
the second is better. But a silent bit-level cast is not
acceptable.
Bye,
bearophile
Sure that is the first i will do tomorrow.
But so far no suggestions?