digitalmars.D.bugs - [Issue 4286] New: Wrong error line number and more with schwartzSort
- d-bugmail puremagic.com (44/44) Jun 06 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4286
- d-bugmail puremagic.com (10/10) Jan 09 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4286
- d-bugmail puremagic.com (7/7) Dec 21 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4286
- d-bugmail puremagic.com (12/12) Jan 10 2013 http://d.puremagic.com/issues/show_bug.cgi?id=4286
http://d.puremagic.com/issues/show_bug.cgi?id=4286 Summary: Wrong error line number and more with schwartzSort Product: D Version: future Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc This is D2 code, I don't understand this bug: import std.typecons: tuple, Tuple; import std.algorithm: schwartzSort; void foo(int N)(char[] txt) { int[char[N]] aa; foreach (i; 0 .. txt.length + 1 - N) { char[N] key = txt[i .. i + N]; aa[key]++; } alias Tuple!(char[N], "key", int, "value") Pair; Pair[] pairs; foreach (key, value; aa) pairs ~= Pair(key, value); schwartzSort!((p){ return tuple(p.value, p.key); })(pairs); } void main() { char[] txt = cast(char[])("this is just a test".dup); foo!(1)(txt); foo!(2)(txt); } DMD v2.046 prints at compile-time: test.d(4061): Error: function test.foo!(1).foo.schwartzSort!(__dgliteral1,"a < b",cast(SwapStrategy)0,Tuple!(char[2u],"key",int,"value")[]).schwartzSort is a nested function and cannot be accessed from foo This work-around seems to fix the program: schwartzSort!((Pair p){ return tuple(p.value, p.key); })(pairs); Also note the wrong line number, this is why I have tagged this as DMD bug instead of Phobos problem. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 06 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4286 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei metalanguage.com AssignedTo|nobody puremagic.com |andrei metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 09 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4286 The wrong line number was fixed in DMD2.054. The other issue is an instance of bug 5939, bug 6217, and various others. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 21 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4286 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED CC| |andrej.mitrovich gmail.com Resolution| |WORKSFORME 14:10:51 PST --- Works in 2.061+. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 10 2013