Bug 9354 – overload resolution picks alias this over const conversion

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-01-19T02:55:31Z
Last change time
2018-09-18T22:22:00Z
Assigned to
No Owner
Creator
Nils

Comments

Comment #0 by nilsbossung — 2013-01-19T02:55:31Z
test.d: --- struct S { int i; alias i this; } void f(const S) { } void f(int) { assert(false); // line 8 } void main() { f(S()); } --- `rdmd test.d`: --- core.exception.AssertError@test(8): Assertion failure --- f(const S) should be called, not f(int). Conversion to const makes a better match than the implicit conversion of alias this: http://dlang.org/function.html#function-overloading
Comment #1 by razvan.nitu1305 — 2018-09-18T22:22:00Z
*** This issue has been marked as a duplicate of issue 5363 ***