[Issue 6458] Multibyte char literals shouldn't implicitly convert to char

2012-07-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6458


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6458] Multibyte char literals shouldn't implicitly convert to char

2012-07-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6458



--- Comment #15 from Kenji Hara k.hara...@gmail.com 2012-07-20 23:33:01 PDT 
---
Fixed for D1:
https://github.com/9rnsr/dmd/commit/6f5ae56f52c1f2a8af921905926a3ea4752ee388

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6458] Multibyte char literals shouldn't implicitly convert to char

2012-07-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6458


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

Version|D2  |D1


--- Comment #14 from Kenji Hara k.hara...@gmail.com 2012-07-19 09:12:46 PDT 
---
D2 is fixed, but D1 also has same issue.

Pull request for D1:
https://github.com/D-Programming-Language/dmd/pull/1056

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6458] Multibyte char literals shouldn't implicitly convert to char

2012-04-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6458


SomeDude lovelyd...@mailmetrash.com changed:

   What|Removed |Added

 CC||lovelyd...@mailmetrash.com


--- Comment #13 from SomeDude lovelyd...@mailmetrash.com 2012-04-20 16:01:13 
PDT ---
This doesn't compile on 2.059 Win32.

PS E:\DigitalMars\dmd2\samples rdmd -w bug.d
bug.d(4): invalid UTF-8 sequence
bug.d(5): invalid UTF-8 sequence
PS E:\DigitalMars\dmd2\samples

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6458] Multibyte char literals shouldn't implicitly convert to char

2012-01-31 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6458


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 CC||and...@metalanguage.com


--- Comment #12 from yebblies yebbl...@gmail.com 2012-02-01 14:48:05 EST ---
*** Issue 6988 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6458] Multibyte char literals shouldn't implicitly convert to char

2012-01-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6458


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

   Keywords||patch


--- Comment #11 from yebblies yebbl...@gmail.com 2012-01-31 15:48:56 EST ---
Actually, this doesn't involve integer range propagation.

https://github.com/D-Programming-Language/dmd/pull/663

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6458] Multibyte char literals shouldn't implicitly convert to char

2011-08-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6458



--- Comment #5 from changlon chang...@gmail.com 2011-08-08 23:14:35 PDT ---
(In reply to comment #4)
 s[0..3] = 'a';
 
 this should raise an exception ?

sorry , I mean  s[0..3] = '�';

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6458] Multibyte char literals shouldn't implicitly convert to char

2011-08-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6458


changlon chang...@gmail.com changed:

   What|Removed |Added

 CC||chang...@gmail.com


--- Comment #4 from changlon chang...@gmail.com 2011-08-08 23:13:53 PDT ---
s[0..3] = 'a';

this should raise an exception ?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6458] Multibyte char literals shouldn't implicitly convert to char

2011-08-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6458



--- Comment #6 from Jonathan M Davis jmdavisp...@gmx.com 2011-08-08 23:19:15 
PDT ---
It shouldn't even compile, because the types don't match. Even with range
propagation, the best that you'll do with '�' is fit it in a wchar, so it won't
fit in a char, and so you _can't_ assign it to each element of s[0 .. 3] like
that. s[0 .. 3] = �[] should work, but s[0 .. 3] = '�' definitely shouldn't.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6458] Multibyte char literals shouldn't implicitly convert to char

2011-08-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6458


Jacob Carlborg d...@me.com changed:

   What|Removed |Added

 CC||d...@me.com


--- Comment #7 from Jacob Carlborg d...@me.com 2011-08-08 23:44:22 PDT ---
As far as I can see, D uses the smallest type necessary to fit a character
literal. So all non-ascii character literals will either be wchar or dchar.
Both of the following passes, as expected.

static assert(is(typeof('�') == wchar));
static assert(is(typeof('a') == char));

But I don't know why the compiler allows to assign a wchar to a char array
element. That doesn't seem right.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6458] Multibyte char literals shouldn't implicitly convert to char

2011-08-09 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6458



--- Comment #8 from Don clugd...@yahoo.com.au 2011-08-09 00:09:02 PDT ---
(In reply to comment #7)
 As far as I can see, D uses the smallest type necessary to fit a character
 literal. So all non-ascii character literals will either be wchar or dchar.
 Both of the following passes, as expected.
 
 static assert(is(typeof('�') == wchar));
 static assert(is(typeof('a') == char));

That's good news. Seems like it's only a few cases where it behaves stupidly.

 But I don't know why the compiler allows to assign a wchar to a char array
 element. That doesn't seem right.

It's more general than that:

   wchar w = '�';
   char c = w; // Error: cannot implicitly convert expression (w) of type wchar
to char


   char c = '�'; // passes!!!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6458] Multibyte char literals shouldn't implicitly convert to char

2011-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6458


Jonathan M Davis jmdavisp...@gmx.com changed:

   What|Removed |Added

 CC||jmdavisp...@gmx.com


--- Comment #1 from Jonathan M Davis jmdavisp...@gmx.com 2011-08-08 21:53:05 
PDT ---
Personally, I think that all character literals should be typed as dchar, since
it's generally a _bad_ idea to operate on individual chars or wchars. Normally,
the only places that chars or wchars should be used is in ranges of chars or
wchars (which would normally be arrays). But making character literals dchar be
default might break too much code at this point. Though, since it should be
possible to use range propagation to verify whether a particular code point
will fit in a particular code unit, the breakage might be minimal.

Regardless, I actually never would have expected s[0 .. 2] = '�' to work, since
you're assigning a character to multiple characters as far as types go, though
I can see why you might think that it would work or why it arguably _should_
work. Obviously though, if the compiler is allowing you to assign a code point
to multiple code units like that, it should only compile if it can verify that
the code unit will fit exactly in those code units, and if it does compile, it
should work correctly rather than generate garbage. So, there are several
issues at work here it seems.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6458] Multibyte char literals shouldn't implicitly convert to char

2011-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6458



--- Comment #3 from Jonathan M Davis jmdavisp...@gmx.com 2011-08-08 22:33:20 
PDT ---
Ah, yes. I forgot that you could assign a single value to every element in an
array like that. That being the case, it should just fail to compile given that
the code point is not going to fit in each of the elements of the array. But
regardless, something odd is definitely going on here given that '�'.sizeof ==
2. It's probably an edge case which wasn't caught, since the only types which
take up multiple elements like that are char and wchar.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---