Bug 605 – Problem w/ function overload resultion and enums.
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2006-11-26T14:09:00Z
Last change time
2014-02-15T13:22:06Z
Assigned to
nobody
Creator
godaves
Comments
Comment #0 by godaves — 2006-11-26T14:09:39Z
The following code shows the problem, which only arises when the struct sockaddr_in definition happens to be included. Otherwise the workaround is an explicit cast.
void main()
{
// foo f = new foo(cast(AddressFamily)AddressFamily.INET);
foo f = new foo(AddressFamily.INET);
}
class foo
{
this(AddressFamily f)
{
}
}
// from std.c.linux.socket
enum: int
{
AF_INET = 2
}
// from std.c.linux.socket
struct sockaddr_in
{
short sin_family = AF_INET;
}
// from std.socket
enum AddressFamily: int
{
INET = AF_INET
}
Comment #1 by clugdbug — 2010-01-19T08:33:11Z
This was fixed between 0.175 and 1.000.
(The example works in 1.053, but not in 1.054; however, that's an unrelated regression).