Bienlein:
Whereas this does not compile:
immutable int b = (int) {
if(1 == 1) {
return 123;
} else {
return 456;
}
}(); // line x
However, this does compile and displays correctly 123:
immutable int b = (int) {
if(1 == 1) {
return 123;
} else {
return 456;
}
}(1); // line y
writeln(b);
Note it says () in line x and (1) in line y. The (1) in line y
is redundant, but the stuff then compiles.
If your D function has one argument, you have to give it one
argument, even if it doesn't have a visible name and it's unused.
Bye,
bearophile