D 2021-10-30T11:27:34.517 L are\sAA\svalue\spointers\sinvalidated\sby\sAA\smutation? U admin W 640

Are AA value pointers invalidated by AA mutation?

In other words, does this program run without error?
void main() { int[int] aa = [1: 2]; int* p = 1 in aa; foreach (i; 3 .. 10_000_000) aa[i] = i; assert(aa.length == 10_000_000 - 2); assert(aa[1] == 2); assert(p == (1 in aa)); }
There's no error, despite it reallocating the AA after the pointer is taken, because the pointer is to an individually allocated bucket, rather than a pointer into the resized backing array. [https://forum.dlang.org/post/slhne0$19t8$1@digitalmars.com|Discussion] Z 6326f9c4cb40ab70f863a3e87065132b