Weird writeln behavior with associative arrays

Masahiro Nakagawa repeatedly at gmail.com
Fri Oct 15 12:21:15 PDT 2010


On Sat, 16 Oct 2010 00:04:22 +0900, Jens Mueller <jens.k.mueller at gmx.de>  
wrote:

> Hi,
>
> this program
> import std.stdio;
>
> void main() {
> 	double[string] foo;
> 	foo["test"] = 10;
> 	foo["atadfest"] = 10;
> 	// fails if foo.length > 1
> 	writeln(foo);
> }
>
> fails with:
> phobos/std/format.d(1088): Enforcement failed
>
> Am I not allowed to to this? If I have only one element, then it works
> as expected. If I change double to int, then I get "test:10 a:10". So
> somehow only the first character is displayed. Maybe a phobos bug? Any
> ideas?
>
> I'm using Linux and latest dmd.
> $ dmd | head -n1
> Digital Mars D Compiler v2.049
>
> Jens

SHOO has already fixed this problem.

http://www.dsource.org/projects/phobos/changeset/2030


More information about the Digitalmars-d mailing list