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 }
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).