misoverloading
Gor Gyolchanyan
gor.f.gyolchanyan at gmail.com
Wed Dec 5 04:20:28 PST 2012
There's a curiously misleading behavior when overloading on the same
underlying types:
struct Test
{
void* ptr;
uint num;
}
alias const(Test) A;
void foo(A)
{
import std.stdio;
writeln("mutable");
}
void foo(const(A))
{
import std.stdio;
writeln("const");
}
unittest
{
foo(A());
}
DMD outputs the following error:
C:\Users\g.gyolchanyan\Desktop\test.d(67): Error: function test.foo called
with argument types:
((const(Test)))
matches both:
C:\Users\g.gyolchanyan\Desktop\test.d(53): test.foo(const(Test) _param_0)
and:
C:\Users\g.gyolchanyan\Desktop\test.d(59): test.foo(const(Test) _param_0)
The error should be about redefinition of foo(), since A and const(A) are
the exact same type.
Is this a bug or am I mistaken on the expected behavior?
--
Bye,
Gor Gyolchanyan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121205/010942b9/attachment.html>
More information about the Digitalmars-d
mailing list