Wrong lowering for a[b][c]++

David Nadlinger see at klickverbot.at
Wed Mar 21 11:29:44 PDT 2012


On Wednesday, 21 March 2012 at 18:27:30 UTC, H. S. Teoh wrote:
> A question was asked on the d-learn forum about why this throws 
> a
> RangeError:
>
> 	int[string][int] map;
> 	map["abc"][20]++;

Wait a second – aren't AAs _supposed_ to throw if accessing a 
key that doesn't exist yet? To be able to increment something, 
there already has to be a value to start from…

David


More information about the Digitalmars-d mailing list