www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Problem with heapified Array!BigInt

I was about to write a bug report on this, but I am not sure what's happening
here, probably I am missing something. I am not even sure this is a bug, so
it's better to ask here first. This crashes at runtime with no stack trace (DMD
2.053beta, I'd like betas to be numbered in any way):


import std.stdio, std.bigint, std.container;
int foo() {
    Array!BigInt bar;
    bar ~= BigInt(2);
    auto spam = heapify(bar);
    spam.insert(BigInt(10));
    spam.insert(BigInt(20));
    return 1;
}
void main() {
    writeln(foo());
}


If I replace the BigInts with ints:

import std.stdio, std.container;
int foo() {
    Array!int bar;
    bar ~= 2;
    auto spam = heapify(bar);
    spam.insert(10);
    spam.insert(20);
    return 1;
}
void main() {
    writeln(foo());
}


I get:
...\dmd\src\phobos\std\container.d(2660): Error: this._store()[this._length()]
is not an lvalue

Is this material for Bugzilla?

Thank you, bye,
bearophile
May 13 2011