<div>There's a curiously misleading behavior when overloading on the same underlying types:</div><div><br></div><div>struct Test</div><div>{</div><div><span class="" style="white-space:pre"> </span>void* ptr;</div><div>
<span class="" style="white-space:pre"> </span>uint num;</div><div>}</div><div><br></div><div>alias const(Test) A;</div><div><br></div><div>void foo(A)</div><div>{</div><div><span class="" style="white-space:pre"> </span>import std.stdio;</div>
<div><span class="" style="white-space:pre"> </span>writeln("mutable");</div><div>}</div><div><br></div><div>void foo(const(A))</div><div>{</div><div><span class="" style="white-space:pre"> </span>import std.stdio;</div>
<div><span class="" style="white-space:pre"> </span>writeln("const");</div><div>}</div><div><br></div><div>unittest</div><div>{</div><div><span class="" style="white-space:pre"> </span>foo(A());</div><div>}</div>
<div><br></div><div>DMD outputs the following error:</div><div><div>C:\Users\g.gyolchanyan\Desktop\test.d(67): Error: function test.foo called with argument types:</div><div><span class="" style="white-space:pre"> </span>((const(Test)))</div>
<div>matches both:</div><div><span class="" style="white-space:pre"> </span>C:\Users\g.gyolchanyan\Desktop\test.d(53): test.foo(const(Test) _param_0)</div><div>and:</div><div><span class="" style="white-space:pre"> </span>C:\Users\g.gyolchanyan\Desktop\test.d(59): test.foo(const(Test) _param_0)</div>
</div><div><br></div><div>The error should be about redefinition of foo(), since A and const(A) are the exact same type.</div><div>Is this a bug or am I mistaken on the expected behavior?</div><div><br></div>-- <br>Bye,<br>
Gor Gyolchanyan.<br>