[Issue 5442] std.algorithm.sort problem with struct with char[10]

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 22 14:58:02 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=5442



--- Comment #2 from SomeDude <lovelydear at mailmetrash.com> 2012-04-22 14:59:01 PDT ---
(In reply to comment #1)
> (but doesn't run as I
> expected, though), due to this :
> import std.stdio;
> 
> struct Foo {
>     int x;
>     this(int x){this.x = x;}
> }
> void main() {
>     auto array = new Foo[10];
>     //for(int i = array.length; i > 1; i--) { array[i].x = i; }
>     auto i = array.length;
>     foreach(Foo f; array) { f.x = --i; write(f.x);}
>     writeln();
>     foreach(Foo f; array) { write(f.x);}
> }
> 
> giving that:
> PS E:\DigitalMars\dmd2\samples> rdmd -O bug.d
> 9876543210
> 0000000000

Never mind this part of the message, it's wrong code.

-- 
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