D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3653 - Problem sorting array of Rebindable
Summary: Problem sorting array of Rebindable
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other Linux
: P2 normal
Assignee: Shin Fujishiro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-26 15:11 UTC by pc
Modified: 2015-06-09 01:28 UTC (History)
1 user (show)

See Also:


Attachments
short test of arrays of Rebindable (2.20 KB, text/x-dsrc)
2009-12-26 15:11 UTC, pc
Details

Note You need to log in before you can comment on or make changes to this issue.
Description pc 2009-12-26 15:11:02 UTC
Created attachment 535 [details]
short test of arrays of Rebindable

Digital Mars D Compiler v2.037

/* The following did not compile. Error deep in phobos due to the line
starting with "sort". (comment it out, and no problem).
*/

import std.traits;
import std.stdio, std.algorithm;

class C1 { int x; this(int x){this.x = x;} int y() const { return x; } }
alias Rebindable!(const(C1)) RC1;

void test3() {
  RC1[] aCs;
  aCs.length = 2;
  aCs[0] = new C1(9);
  aCs[1] = new C1(10);
  aCs ~= RC1(new C1(8));
  sort!("a.x < b.x")(aCs); //compiles only after hack (see attached file)
  foreach(ac; aCs)
    writeln(ac.y());
}
Comment 1 pc 2009-12-26 15:14:42 UTC
Comment on attachment 535 [details]
short test of arrays of Rebindable

Note: to make this compile without the hack in the attached file, one would have to import std.typecons as well as commenting out the sort line..
Comment 2 Shin Fujishiro 2010-05-26 02:57:50 UTC
Fixed in svn r1554. Thanks for the patch! (or hack ;-))