Because no member nor struct type is different below, all calls are expected to be resolved to the same foo overload. However, that's not the case:
struct S {
const(int)[] c;
}
int foo(S s) {
return 1;
}
int foo(immutable(S) s) {
return 2;
}
void main() {
// This call is resolved to foo(S):
const(int)[] arr;
assert(foo(const(S)(arr)) == 1);
// These are unexpectedly resolved to foo(immutable(S)):
assert(foo(const(S)()) == 1); // FAILS
assert(foo(const(S)(null)) == 1); // FAILS
}
Ali