D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 605 - Problem w/ function overload resultion and enums.
Summary: Problem w/ function overload resultion and enums.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-26 14:09 UTC by Dave
Modified: 2014-02-15 13:22 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Dave 2006-11-26 14:09:39 UTC
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 Don 2010-01-19 08:33:11 UTC
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).