Thread overview
DMD 0.97: crash with struct sorting
Aug 04, 2004
k2
Aug 04, 2004
Arcane Jill
Aug 04, 2004
Nick
Aug 04, 2004
Juanjo Álvarez
Aug 05, 2004
Nick
August 04, 2004
DMD 0.97: crash with struct sorting

This code causes DMD 0.97 to segfault:

struct Foo {

int opCmp(Foo f)
{
return 0;
}
}

int main(char[][] args)
{
Foo[] foo;

foo.sort;

return 0;
}

---
w2000 DMD 0.97


August 04, 2004
In article <ceq9g7$25mj$1@digitaldaemon.com>, k2 says...
>
>DMD 0.97: crash with struct sorting
>
>This code causes DMD 0.97 to segfault:
>
>struct Foo {
>
>int opCmp(Foo f)
>{
>return 0;
>}
>}
>
>int main(char[][] args)
>{
>Foo[] foo;
>
>foo.sort;
>
>return 0;
>}
>
>---
>w2000 DMD 0.97
>
>


Presumably Foo.sizeof is zero, which I imagine would cause problems for sort?

Jill


August 04, 2004
In article <cerbqk$cus$1@digitaldaemon.com>, Arcane Jill says...
>
>Presumably Foo.sizeof is zero, which I imagine would cause problems for sort?
>
>Jill

It's the compiler that crashes, not the program. (A simple test also comfirms that .sort doesn't mind empty arrays.)

Nick


August 04, 2004
k2 wrote:

> DMD 0.97: crash with struct sorting
> 
> This code causes DMD 0.97 to segfault:
> 
> struct Foo {
> 
> int opCmp(Foo f)
> {
> return 0;
> }
> }
> 
> int main(char[][] args)
> {
> Foo[] foo;
> 
> foo.sort;
> 
> return 0;
> }

Seems to work on Linux.

August 05, 2004
In article <cers5l$m3a$1@digitaldaemon.com>, Juanjo =?ISO-8859-15?Q?=C1lvarez?= says...
>
>
>Seems to work on Linux.
>

I get a segfault on Linux, haven't tried Windows (but it should be the same.) Since k2 used the word "segfault" I assume that was on Linux as well.

Nick