Namespace: > But so far no suggestions? This seems to work, but solutions that use cast() are sometimes fragile (and dangerous): auto foo(bool b) { final switch (b) { case false: return 20.0; case true: return cast(typeof(return))10; } } void main() { import std.stdio: writeln; writeln(foo(false)); writeln(foo(true)); } Bye, bearophile