Bug 24408 – AF_INET6 duplicated in core.sys.linux.sys.socket
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2024-02-24T03:47:51Z
Last change time
2024-02-24T08:24:16Z
Keywords
pull
Assigned to
No Owner
Creator
Jonathan M Davis
Comments
Comment #0 by issues.dlang — 2024-02-24T03:47:51Z
This program
---
void main()
{
import core.sys.linux.sys.socket;
import core.sys.posix.sys.socket;
auto _ = AF_INET6;
}
---
fails to compile, giving the error
---
q.d(60): Error: `AF_INET6` matches conflicting symbols:
/usr/local/include/dmd/core/sys/linux/sys/socket.d(74): enum member `core.sys.linux.sys.socket.AF_INET6`
/usr/local/include/dmd/core/sys/posix/sys/socket.d(1848): enum member `core.sys.posix.sys.socket.AF_INET6`
---
core.sys.linux.sys.socket publicly imports core.sys.posix.sys.socket like it's supposed to, but it then declares AF_INET6 locally, which is unnecessary and causes the compilation error above, since it's declared in core.sys.posix.sys.socket, because it's standard POSIX.
Comment #1 by dlang-bot — 2024-02-24T03:52:22Z
@jmdavis created dlang/dmd pull request #16241 "Fix bugzilla issue 24408 - Remove duplicate AF_INET6 declaration." fixing this issue:
- Fix bugzilla issue 24408 - Remove duplicate AF_INET6 declaration.
It's already declared in core.sys.posix.sys.socket, so declaring it in
core.sys.linux.sys.socket causes a conflict in code that imports both.
The Linux-specific module publicly imports the POSIX one, so the
declaration in the Linux one is unnecessary. This removes it.
https://github.com/dlang/dmd/pull/16241
Comment #2 by dlang-bot — 2024-02-24T08:24:16Z
dlang/dmd pull request #16241 "Fix bugzilla issue 24408 - Remove duplicate AF_INET6 declaration." was merged into master:
- 634ce7cc54577168e93a2bbbb461bc2a12943ddd by Jonathan M Davis:
Fix bugzilla issue 24408 - Remove duplicate AF_INET6 declaration.
It's already declared in core.sys.posix.sys.socket, so declaring it in
core.sys.linux.sys.socket causes a conflict in code that imports both.
The Linux-specific module publicly imports the POSIX one, so the
declaration in the Linux one is unnecessary. This removes it.
https://github.com/dlang/dmd/pull/16241