[Issue 5016] New: to!() can not convert from wide characters to char
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Oct 8 01:04:02 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5016
Summary: to!() can not convert from wide characters to char
Product: D
Version: D2
Platform: Other
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: aarti at interia.pl
--- Comment #0 from Marcin Kuszczak <aarti at interia.pl> 2010-10-08 01:03:34 PDT ---
Test case:
void main() {
//Instantiation error
dchar from0 = 'A';
char to0 = to!(char)(from0);
//Instantiation error
wchar from1 = 'A';
char to1 = to!(char)(from1);
//Ok
char from2 = 'A';
char to2 = to!(char)(from2);
//Ok
char from3 = 'A';
wchar to3 = to!(wchar)(from3);
//Ok
char from4 = 'A';
dchar to4 = to!(dchar)(from4);
}
It's interesting case as failing conversions should not always succeed (e.g.
when wchar/dchar can not be coded in one byte), while in many cases they are
perfectly valid.
I am starting thinking that assuming that strings/chars are just arrays is
quite a big mistake in D design: it introduces a lot of corner cases.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list