You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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); // FAILSassert(foo(const(S)(null)) == 1); // FAILS
}
Ali
The text was updated successfully, but these errors were encountered:
Ali Cehreli (@acehreli) reported this on 2017-01-01T01:33:24Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=17050
Description
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 } AliThe text was updated successfully, but these errors were encountered: