| |
 | Posted by Kris in reply to mrw | Permalink Reply |
|
Kris 
| This is a bizarre one.
JJR noticed the same issue on linux recently and I took a look at it yesterday. Here's where the error occurs:
class NewlineWriter : INewlineWriter
{
private char[] fmt;
this ()
{
version (Posix)
this (cast(char[]) FileConst.NewlineString);
else
this (FileConst.NewlineString); // ******* ERROR HERE!
}
this (char[] fmt)
{
this.fmt = fmt;
}
}
and here's the FileConst reference:
struct FileConst
{
version (Win32)
{
static const char PathSeparatorChar = '\\';
static const char FileSeparatorChar = '.';
static const char RootSeparatorChar = ':';
static const char[] PathSeparatorString = "\\";
static const char[] FileSeparatorString = ".";
static const char[] RootSeparatorString = ":";
static const char[] NewlineString = "\r\n";
}
version (Posix)
{
static const char PathSeparatorChar = '/';
static const char FileSeparatorChar = '.';
static const char RootSeparatorChar = ':';
static const char[] PathSeparatorString = "/";
static const char[] FileSeparatorString = ".";
static const char[] RootSeparatorString = ":";
static const char[] NewlineString = "\n";
}
}
As you can see, I hacked the Posix version to "recast" FileConst.Newline into a char[], even though it's clearly declared as one to begin with. The 'recast' gets rid of the error, but I've absolutely no idea why it happens. Perhaps Walter could shed some light on this?
To get around it for now, do the stupid 'recast' for the Win32 version also. It's really odd that this just started happening, with no changes to the related code, and only in this one very specific instance (other references to FileConst are just fine!)
- Kris
"mrw" <mark@binarytheory.com> wrote in message news:dt0d2q$21p3$1@digitaldaemon.com...
> <NewDUser>
> I'm trying to build Mango on Windows. Yesterday I used SVN to get the
> latest source. When I run 'build @mango' I get compile errors in
> mango.io:
>
> C:\dmd\mango\mango\io\Writer.d(701): constructor
> mango.io.Writer.NewlineWriter.this () does not match argument types
> (void[])
> C:\dmd\mango\mango\io\FileConst.d(59): cannot implicitly convert
> expression
> ("\x0d\x0a") of type void[] to char[]
> C:\dmd\mango\mango\io\Stdout.d(149): template instance cannot resolve
> forward reference
> C:\dmd\mango\mango\io\Stdout.d(149): UnicodeImporter!(...) is used as a
> type
> C:\dmd\mango\mango\io\Stdout.d(149): new can only create structs, dynamic
> arrays or class objects, not void's
> C:\dmd\mango\mango\io\Stdout.d(149): function
> mango.io.Writer.Writer.setEncoder(AbstractEncoder) does not match argument
> types (void*)
> C:\dmd\mango\mango\io\Stdout.d(149): cannot implicitly convert expression
> (new UnicodeImporter!(...)((Cout))) of type void* to
> mango.io.model.IBuffer.AbstractEncoder
> C:\dmd\mango\mango\io\Stdout.d(150): template instance cannot resolve
> forward reference
> C:\dmd\mango\mango\io\Stdout.d(150): UnicodeImporter!(char) is used as a
> type
> C:\dmd\mango\mango\io\Stdout.d(150): new can only create structs, dynamic
> arrays or class objects, not void's
> C:\dmd\mango\mango\io\Stdout.d(150): function
> mango.io.Writer.Writer.setEncoder(AbstractEncoder) does not match argument
> types (void*)
> C:\dmd\mango\mango\io\Stdout.d(150): cannot implicitly convert expression
> (new UnicodeImporter!(char)((Cerr))) of type void* to
> mango.io.model.IBuffer.AbstractEncoder
>
> Can anyone suggest a solution? I'm using DMD 0.145 </NewDUser>
>
> Thanks,
> Mark
>
>
>
>
|