Problem with heapified Array!BigInt

bearophile bearophileHUGS at lycos.com
Fri May 13 12:07:35 PDT 2011


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


More information about the Digitalmars-d-learn mailing list