assocArray.remove() gives strange error

Steven Schveighoffer schveiguy at yahoo.com
Mon Dec 27 07:15:47 PST 2010


On Fri, 24 Dec 2010 00:58:37 -0500, Mariusz Gliwiński  
<alienballance at gmail.com> wrote:

> When i compile:
> <code>type[key2][key1] assocArray1;
> assocArray1[key1].remove(key2);</code>
>
> everything is ok, but building
> <code>type[key2][key1] assocArray1;
> return (assocArray1[key1].remove(key2));</code>
>
> gives
> <code>dmd: expression.c:817: void expToCBuffer(OutBuffer*, HdrGenState*,
> Expression*, PREC): Assertion `pr != PREC_zero' failed.</code>
>
> while the book states it should return bool, which typeof() supports
>
> Digital Mars D Compiler v2.049
> Copyright (c) 1999-2010 by Digital Mars written by Walter Bright
> Documentation: http://www.digitalmars.com/d/2.0/index.html

Part of this a compiler error, the clue is that it's expression.c.  Looks  
like it was fixed.

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

It was fixed in 2.050.  Now the error is:

Error: cannot implicitly convert expression ... of type void to bool

Here is the relevant report for that:

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

-Steve


More information about the Digitalmars-d mailing list