Bug 7729 – fileno conflict

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-03-18T08:59:00Z
Last change time
2017-07-10T12:47:44Z
Assigned to
nobody
Creator
doob

Comments

Comment #0 by doob — 2012-03-18T08:59:31Z
"fileno" declared in std.stdio conflicts with the one declared in core.stdc.stdio. Removing the following line should fix the problem: https://github.com/D-Programming-Language/phobos/blob/master/std/stdio.d#L38
Comment #1 by andy — 2015-01-25T19:09:22Z
I'm not sure how to test this. Is this a good test? // file test.d: import std.stdio; import core.stdc.stdio; void main() { File f = File("test.d", "r"); writeln( f.fileno() ); } This compiles and runs fine. Is this still a problem? Can you post some sample code?
Comment #2 by doob — 2015-01-25T19:58:10Z
(In reply to AndyC from comment #1) > Is this still a problem? Can you post some sample code? import std.stdio; import core.stdc.stdio; void main () { FILE* f; fileno(f); } The error message I get: main.d(7,11): Error: core.stdc.stdio.fileno at ~/.dvm/compilers/dmd-2.066.1/osx/bin/../../src/druntime/import/core/stdc/stdio.d(773,10) conflicts with core.sys.posix.stdio.fileno at ~/.dvm/compilers/dmd-2.066.1/osx/bin/../../src/druntime/import/core/sys/posix/stdio.d(192,8) So actually now it's a conflict between core.stdc.stdio and core.sys.posix.stdio.
Comment #3 by schveiguy — 2015-01-26T13:19:06Z
So maybe this is Posix only? I'm curious actually, how come these conflict? Both are extern(C), so they are pointing at the same symbol.
Comment #4 by doob — 2015-01-26T17:52:48Z
(In reply to Steven Schveighoffer from comment #3) > So maybe this is Posix only? > > I'm curious actually, how come these conflict? Both are extern(C), so they > are pointing at the same symbol. Yeah, but does the compiler know that? Or rather, I don't think it uses different rules for looking up symbols depending on if they're extern(C).
Comment #5 by andy — 2015-01-27T03:38:16Z
This code compiles fine on windows: import std.stdio; import core.stdc.stdio; void main () { FILE* f; fileno(f); }
Comment #6 by schveiguy — 2015-01-27T04:04:27Z
(In reply to AndyC from comment #5) > This code compiles fine on windows: Right, because Windows does not import or declare anything via core.sys.posix. The bug is posix-only (there isn't a drop-down for that though).
Comment #7 by razvan.nitu1305 — 2017-07-10T12:22:28Z
Cannot reproduce on Ubuntu 16.04 with latest dmd.
Comment #8 by schveiguy — 2017-07-10T12:47:44Z
The alias was removed here: https://github.com/dlang/phobos/pull/2809 So it was actually fixed before Jacob's test in January of 2015, but hadn't made it into the released compiler yet.