www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Dpaste vs dmd 2.063.2 errors

reply "JS" <js.mdnq gmail.com> writes:
http://dpaste.dzfl.pl/27ca3fbd

The code compiles fine on my computer. On DPaste there is all 
kinds of errors(when fixing one other errors pop up.

I am compiling to 32-bit binary and that is the only real 
difference I can see, but surely it wouldn't result in such 
errors?

The first error:

/d547/f451.d(227): Error: unterminated character constant
/d547/f451.d(227): Error: unterminated character constant
/d547/f451.d(227): Error: found '41U' when expecting ')'

makes no sense as far as I can tell unless my expand code 
generation templates are messed up.

If someone wouldn't mind trying to compile the code and see if 
the errors are similar to dpaste I'd appreciate it. (I don't want 
to end up writing code that is very bad(even though this is just 
proof of concept code) and will end up breaking)
Jul 23 2013
next sibling parent reply "monarch_dodra" <monarchdodra gmail.com> writes:
On Tuesday, 23 July 2013 at 12:26:31 UTC, JS wrote:
 http://dpaste.dzfl.pl/27ca3fbd

 The code compiles fine on my computer. On DPaste there is all 
 kinds of errors(when fixing one other errors pop up.

 I am compiling to 32-bit binary and that is the only real 
 difference I can see, but surely it wouldn't result in such 
 errors?

 The first error:

 /d547/f451.d(227): Error: unterminated character constant
 /d547/f451.d(227): Error: unterminated character constant
 /d547/f451.d(227): Error: found '41U' when expecting ')'

 makes no sense as far as I can tell unless my expand code 
 generation templates are messed up.

 If someone wouldn't mind trying to compile the code and see if 
 the errors are similar to dpaste I'd appreciate it. (I don't 
 want to end up writing code that is very bad(even though this 
 is just proof of concept code) and will end up breaking)
I'm getting some compile errors, because you are trying to cram a size_t into a int: hello.d(179): Error: cannot implicitly convert expression (s.length - 1LU) of type ulong to int if (s[max(0, j - d[0].length + 1)..s.length] == d[0]) { maxL = max(maxL, d[0].length); } if (s[max(0, j - d[1].length + 1)..s.length] == d[1]) { maxL = max(maxL, d[1].length); } if (s[max(0, j - d[2].length + 1)..s.length] == d[2]) { maxL = max(maxL, d[2].length); } hello.d(182): Error: cannot implicitly convert expression (max(maxL, _param_1.length)) of type ulong to int hello.d(183): Error: cannot implicitly convert expression (max(maxL, _param_2.length)) of type ulong to int hello.d(184): Error: cannot implicitly convert expression (max(maxL, _param_3.length)) of type ulong to int hello.d(192): Error: template instance hello.stripRight!(string, string, string) error instantiating hello.d(237): instantiated from here: strip!(string, string, string) if (s[j..min(s.length, j + d[0].length)] == d[0]) { maxL = max(maxL, d[0].length); } if (s[j..min(s.length, j + d[1].length)] == d[1]) { maxL = max(maxL, d[1].length); } if (s[j..min(s.length, j + d[2].length)] == d[2]) { maxL = max(maxL, d[2].length); } hello.d(166): Error: cannot implicitly convert expression (max(maxL, _param_1.length)) of type ulong to int hello.d(167): Error: cannot implicitly convert expression (max(maxL, _param_2.length)) of type ulong to int hello.d(168): Error: cannot implicitly convert expression (max(maxL, _param_3.length)) of type ulong to int hello.d(192): Error: template instance hello.stripLeft!(string, string, string) error instantiating hello.d(237): instantiated from here: strip!(string, string, string) hello.d(237): Error: template instance hello.strip!(string, string, string) error instantiating if (s[j..min(s.length, j + d[0].length)] == d[0]) { maxL = max(maxL, d[0].length); } if (s[j..min(s.length, j + d[1].length)] == d[1]) { maxL = max(maxL, d[1].length); } hello.d(128): Error: cannot implicitly convert expression (max(maxL, _param_1.length)) of type ulong to int hello.d(129): Error: cannot implicitly convert expression (max(maxL, _param_2.length)) of type ulong to int hello.d(238): Error: template instance hello.split!(string, string) error instantiating hello.d(179): Error: cannot implicitly convert expression (s.length - 1LU) of type ulong to int if (s[j] == d[0]) { maxL = max(maxL, 1); } hello.d(175): Error: template instance hello.stripRight!(char) error instantiating hello.d(239): instantiated from here: stripRight!() hello.d(239): Error: template instance hello.stripRight!() error instantiating if (s[j..min(s.length, j + d[0].length)] == d[0]) { return j; } if (s[j..min(s.length, j + d[1].length)] == d[1]) { return j; } Once you change those, the program compiles (on my machine anyways). Running it produces strange output though: Compilation: if (s[max(0, j - d[0].length + 1)..s.length] == d[0]) { maxL = max(maxL, d[0].length); } if (s[max(0, j - d[1].length + 1)..s.length] == d[1]) { maxL = max(maxL, d[1].length); } if (s[max(0, j - d[2].length + 1)..s.length] == d[2]) { maxL = max(maxL, d[2].length); } if (s[j..min(s.length, j + d[0].length)] == d[0]) { maxL = max(maxL, d[0].length); } if (s[j..min(s.length, j + d[1].length)] == d[1]) { maxL = max(maxL, d[1].length); } if (s[j..min(s.length, j + d[2].length)] == d[2]) { maxL = max(maxL, d[2].length); } if (s[j..min(s.length, j + d[0].length)] == d[0]) { maxL = max(maxL, d[0].length); } if (s[j..min(s.length, j + d[1].length)] == d[1]) { maxL = max(maxL, d[1].length); } if (s[j] == d[0]) { maxL = max(maxL, 1); } if (s[j..min(s.length, j + d[0].length)] == d[0]) { return j; } if (s[j..min(s.length, j + d[1].length)] == d[1]) { return j; } Run: acdb99:{9acdb99 db99:{9acdb9 acdb99 9acdb99 aaaaa a b c
Jul 23 2013
parent "JS" <js.mdnq gmail.com> writes:
On Tuesday, 23 July 2013 at 12:59:11 UTC, monarch_dodra wrote:
 On Tuesday, 23 July 2013 at 12:26:31 UTC, JS wrote:
 http://dpaste.dzfl.pl/27ca3fbd

 The code compiles fine on my computer. On DPaste there is all 
 kinds of errors(when fixing one other errors pop up.

 I am compiling to 32-bit binary and that is the only real 
 difference I can see, but surely it wouldn't result in such 
 errors?

 The first error:

 /d547/f451.d(227): Error: unterminated character constant
 /d547/f451.d(227): Error: unterminated character constant
 /d547/f451.d(227): Error: found '41U' when expecting ')'

 makes no sense as far as I can tell unless my expand code 
 generation templates are messed up.

 If someone wouldn't mind trying to compile the code and see if 
 the errors are similar to dpaste I'd appreciate it. (I don't 
 want to end up writing code that is very bad(even though this 
 is just proof of concept code) and will end up breaking)
I'm getting some compile errors, because you are trying to cram a size_t into a int:
Thanks. No idea about the inden error? Any idea what command line switch is used to turn on warnings and errors about casting? (I've started using -w and -wi)
Jul 23 2013
prev sibling parent =?UTF-8?B?UmFwaGHDq2wgSmFrc2U=?= <raphael.jakse gmail.com> writes:
Le 23/07/2013 14:26, JS a écrit :
 http://dpaste.dzfl.pl/27ca3fbd

 The code compiles fine on my computer. On DPaste there is all kinds of
 errors(when fixing one other errors pop up.

 I am compiling to 32-bit binary and that is the only real difference I
 can see, but surely it wouldn't result in such errors?

 The first error:

 /d547/f451.d(227): Error: unterminated character constant
 /d547/f451.d(227): Error: unterminated character constant
 /d547/f451.d(227): Error: found '41U' when expecting ')'

 makes no sense as far as I can tell unless my expand code generation
 templates are messed up.

 If someone wouldn't mind trying to compile the code and see if the
 errors are similar to dpaste I'd appreciate it. (I don't want to end up
 writing code that is very bad(even though this is just proof of concept
 code) and will end up breaking)
Trying to compile with gdc (gcc 4.6.4): $ gdc dpaste.d dpaste.d:179: Error: cannot implicitly convert expression (s.length - 1LU) of type ulong to int Changing int to auto at line 179: $ gdc dpaste.d if (s[max(0, j - d[0].length + 1)..s.length] == d[0]) { maxL = max(maxL, d[0].length); } if (s[max(0, j - d[1].length + 1)..s.length] == d[1]) { maxL = max(maxL, d[1].length); } if (s[max(0, j - d[2].length + 1)..s.length] == d[2]) { maxL = max(maxL, d[2].length); } dpaste.d:182: Error: argument to mixin must be a string, not (ExpandVariadicIf!("??Cs[j]??s[max(0, j - %%L + 1)..s.length]::","d","maxL = max(maxL, %%L);",string,string,string)) with dmd I have quite the same thing as monarch_dodra.
Jul 23 2013