www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - What is this error?!

reply "Mehrdad" <wfunction hotmail.com> writes:
Trying to compile
    import std.stdio, std.cstream;
    alias file a;
gives
    [...]\windows\bin\..\..\src\phobos\std\stdio.d(257): Error: struct 
std.stdio.File conflicts with class std.stream.File at 
[...]\windows\bin\..\..\src\phobos\std\stream.d(1807)
    [...]\Temp2.d(2): Error: undefined identifier file, did you mean struct 
File?

IMHO the first error is a little silly... 
Apr 25 2012
next sibling parent Timon Gehr <timon.gehr gmx.ch> writes:
On 04/25/2012 12:01 PM, Mehrdad wrote:
 Trying to compile
 import std.stdio, std.cstream;
 alias file a;
 gives
 [...]\windows\bin\..\..\src\phobos\std\stdio.d(257): Error: struct
 std.stdio.File conflicts with class std.stream.File at
 [...]\windows\bin\..\..\src\phobos\std\stream.d(1807)
 [...]\Temp2.d(2): Error: undefined identifier file, did you mean struct
 File?

 IMHO the first error is a little silly...

Issues should go straight to the bug tracker.
Apr 25 2012
prev sibling parent "Jonathan M Davis" <jmdavisProg gmx.com> writes:
On Wednesday, April 25, 2012 03:01:23 Mehrdad wrote:
 Trying to compile
 import std.stdio, std.cstream;
 alias file a;
 gives
 [...]\windows\bin\..\..\src\phobos\std\stdio.d(257): Error: struct
 std.stdio.File conflicts with class std.stream.File at
 [...]\windows\bin\..\..\src\phobos\std\stream.d(1807)
 [...]\Temp2.d(2): Error: undefined identifier file, did you mean struct
 File?
 
 IMHO the first error is a little silly...

The first error makes perfect sense if you use File with both of those imports, but you used _file_, not File, so that's definitely weird. It's almost like the alias is being dealt with in a case-insensitive manner, which it shouldn't be. My _guess_ would be that it's simply an issue with the spell checker - since that _would_ look into other cases. It probably is looking for symbols close to file, finds File in both std.stdio and std.cstream, and then ends up spitting out an error due to the conflict. It _shouldn't_, since the module isn't actually using File, but I guess that however the spell checker works, it ended up acting like it was importing it. Certainly, it looks like a bug. - Jonathan M Davis
Apr 25 2012