A pointer pointing to freed memory, which presumably '&a[0]' should be because it reallocates.What is your definition of a dangling pointer?
It seems that the '~=' operator "knows" that there's a reference to 'a's old memory and it keeps it around instead of freeing it.
I just don't understand the mechanism behind this.