On Mon, 16 May 2011 16:06:34 -0400, KennyTM~ <kenn...@gmail.com> wrote:
The compiler blindly accepts an 'int' as a 'dchar' argument, not -1. For
instance,
void main(){
string ret;
ret ~= 0x10ffff; // ok
ret ~= 0x110000; // Error: cannot append type int to type string
int i = 0x110000;
ret ~= i; // ok, but should fail at compile time
}
the issue is also that an 'int' shouldn't be implicitly convertible to a
'dchar'.
Yes, you are completely right, it seems the compiler isn't inconsistent
WRT string appending and calling a normal function, it fails/passes the
same way, depending on whether the argument passed is a variable or a
literal.
So it seems the correct solution is for it to do range propagation, and
refuse to compile implicit casts where it results in an invalid dchar
(which includes the case where the int could be anything).
Sorry for the confusion, I thought I tested one thing, and actually tested
another, yada yada...
-Steve