Thread overview | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 09, 2011 [Issue 6632] New: toUTFz sometimes does not work with const parameters | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=6632 Summary: toUTFz sometimes does not work with const parameters Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: andrej.mitrovich@gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-09-08 17:47:46 PDT --- import std.utf; void main() { const char[] c = ""; auto res1 = toUTFz!(const(char)*)(c); // doesn't work auto res2 = toUTFz!(const(wchar)*)(c); // works ok } D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\utf.d(1481): Error: variable std.utf.toUTFz!(const(char)*,const(char[])).toUTFz.str cannot modify const test.d(8): Error: template instance std.utf.toUTFz!(const(char)*,const(char[])) error instantiating Funny thing is it works fine with immutable: immutable char[] c = ""; auto res1 = toUTFz!(const(char)*)(c); // ok -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 09, 2011 [Issue 6632] toUTFz sometimes does not work with const parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=6632 zeljkog <zeljko.grk@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |zeljko.grk@gmail.com --- Comment #1 from zeljkog <zeljko.grk@gmail.com> 2011-09-09 15:36:01 CEST --- It is compiler issue: import std.stdio; void f(S)(S str){ writeln(str); } alias f!(string) fc; alias f!(wstring) fc; void main(){ fc("foo"); // L11 //~ fc("foo"c); // works //~ auto s = "foo"; //~ fc(s); // works } //~ Compilation breaks with message: //~ bug.d(11): Error: function alias bug.f called with argument types: //~ ((string)) //~ matches both: //~ bug.f!(string).f(string str) //~ and: //~ bug.f!(immutable(wchar)[]).f(immutable(wchar)[] str) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 09, 2011 [Issue 6632] toUTFz sometimes does not work with const parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=6632 --- Comment #2 from zeljkog <zeljko.grk@gmail.com> 2011-09-09 15:44:55 CEST --- Sorry, it's another issue. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 09, 2011 [Issue 6632] toUTFz sometimes does not work with const parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=6632 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |major --- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-11-09 09:58:23 PST --- import std.utf; const wchar[] foo = "foo"; void main() { auto wptr = toUTFz!(const(wchar)*)(foo); // NG } It would be great if toUTFz worked in *all* cases. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 09, 2011 [Issue 6632] toUTFz sometimes does not work with const parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=6632 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |jmdavisProg@gmx.com --- Comment #4 from Jonathan M Davis <jmdavisProg@gmx.com> 2011-11-09 10:19:23 PST --- Well obviously, the fact that it doesn't is a bug. I expect that I'll have it fixed before the next release. I probably should have had it fixed for the last one but have been busy and didn't get around to it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 09, 2011 [Issue 6632] toUTFz sometimes does not work with const parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=6632 --- Comment #5 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-11-09 10:51:57 PST --- Thanks Jonathan. This kind of call is common when passing wstring constants to Win API functions. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 12, 2011 [Issue 6632] toUTFz sometimes does not work with const parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=6632 --- Comment #6 from Jonathan M Davis <jmdavisProg@gmx.com> 2011-11-12 11:00:47 PST --- By the way, in case you didn't notice, I should point out that thanks to the discussion on the newsgroup about it, toUTF16z is no longer scheduled for deprecation. It's still using its old implementation internally, but should be switched over to using toUTFz by the next release (which will allow it to take all of the string types). So, if your use case of toUTFz matches toUTF16z, then you can use that. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 12, 2011 [Issue 6632] toUTFz sometimes does not work with const parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=6632 --- Comment #7 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-11-12 11:24:01 PST --- Ok good to know, this will help porting older code. Thanks. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 20, 2011 [Issue 6632] toUTFz sometimes does not work with const parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=6632 --- Comment #8 from Jonathan M Davis <jmdavisProg@gmx.com> 2011-11-20 04:52:50 PST --- https://github.com/D-Programming-Language/phobos/pull/279 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 04, 2012 [Issue 6632] toUTFz sometimes does not work with const parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=6632 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #9 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-01-04 06:57:43 PST --- Fixed in 2.057, thanks Jonathan. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation