digitalmars.D.bugs - [Issue 6547] New: Call to std.algorithm.remove causes compile error
- d-bugmail puremagic.com (29/29) Aug 23 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6547
- d-bugmail puremagic.com (33/33) Feb 16 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6547
- d-bugmail puremagic.com (21/21) Mar 13 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6547
- d-bugmail puremagic.com (14/14) Mar 16 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6547
- d-bugmail puremagic.com (13/13) Apr 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6547
- d-bugmail puremagic.com (20/20) Jun 08 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6547
http://d.puremagic.com/issues/show_bug.cgi?id=6547 Summary: Call to std.algorithm.remove causes compile error Product: D Version: D2 Platform: x86_64 OS/Version: Mac OS X Status: NEW Severity: major Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: itsallaboutthedyo gmail.com --- Comment #0 from Tim Keating <itsallaboutthedyo gmail.com> 2011-08-23 20:52:31 PDT --- This minimal use case generates an error in std.algorithm: char[] s = "<html>Some fake HTML for your testing pleasure</html>".dup; auto start = s.find("<"); auto len = s[start..$].find(">"); s = s.remove(tuple(start, start+len+1)); writeln(s); The compile error I get from this is: /usr/local/Cellar/dmd/2.054/src/phobos/std/algorithm.d(5826): Error: front(src) is not an lvalue /usr/local/Cellar/dmd/2.054/src/phobos/std/algorithm.d(5826): Error: front(tgt) is not an lvalue I pulled the most current version of Phobos from github and it has the same problem, though there it occurs on line 5933. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 23 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6547 Yuri Gorobets <yuri.gorobets gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yuri.gorobets gmail.com --- Comment #1 from Yuri Gorobets <yuri.gorobets gmail.com> 2012-02-16 03:25:32 PST --- (In reply to comment #0) This behavior appears to be as designed. The compilation problem is caused by special treatment of the "narrow strings" by std.array: http://dlang.org/glossary.html#narrow%20strings import std.array; import std.algorithm; void main() { char[] s = "narrow".dup; s.remove(0); // Error: template std.algorithm.move(T) // does not match any function template declaration // Error: template std.algorithm.move(T) cannot deduce // template function from argument types !()(dchar,dchar) // remove troubles are caused by the special treatment of narrow strings // front(s) doesn't return a char reference but dchar value instead: s.front = 'c'; // Error: s.front is not an lvalue } dchar version works fine: void main() { dchar[] u = "unicode"d.dup; u.remove(0); // works fine u.front = 'c'; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 16 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6547 Tim Keating <itsallaboutthedyo gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #2 from Tim Keating <itsallaboutthedyo gmail.com> 2012-03-13 15:39:44 PDT --- I will say that I don't agree with this assessment -- the bug isn't really about user error while operating on a narrow string, but about how the compiler & library combo respond to that misuse. To wit, anytime a user gets a cryptic error message buried deep inside a library in response to a simple mistake, you have disempowered them from solving their own problem and derailed their momentum in learning the language. That said, under 2.058 the error message is now: test.d(11): Error: cannot implicitly convert expression (start) of type char[] to ulong Which makes it clear that find(string, string) is returning a slice. I think this specific issue should be closed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 13 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6547 Tim Keating <itsallaboutthedyo gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | --- Comment #3 from Tim Keating <itsallaboutthedyo gmail.com> 2012-03-16 12:26:44 PDT --- The minimal use case described by Yuri above still occurs with 2.058. If this isn't supposed to work for narrow strings, then perhaps a template specialization for the unsupported types that raises a useful error message is the right solution here? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 16 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6547 SomeDude <lovelydear mailmetrash.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lovelydear mailmetrash.com Platform|x86_64 |All OS/Version|Mac OS X |All Severity|major |normal --- Comment #4 from SomeDude <lovelydear mailmetrash.com> 2012-04-22 03:24:38 PDT --- Reduced to "normal" -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 22 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6547 Jonathan M Davis <jmdavisProg gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED CC| |jmdavisProg gmx.com Resolution| |FIXED --- Comment #5 from Jonathan M Davis <jmdavisProg gmx.com> 2012-06-08 02:05:32 PDT --- As of 2.059, this is the error that you get: q.d(10): Error: cannot implicitly convert expression (start) of type char[] to ulong q.d(11): Error: template std.typecons.tuple does not match any function template declaration /home/jmdavis/dmd2/linux/bin/../../src/phobos/std/typecons.d(687): Error: template std.typecons.tuple(T...) cannot deduce template function from argument types !()(char[],_error_) which is much better than the one originally reported. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 08 2012