> Why would it do anything special here? This is not really different from something like this:
Yeah, I suppose you're right. I was Googling potential interesting cases and ran across this one[1] which made me think of weird edge cases w.r.t. self-reference.
There isn’t anything weird about this. A circularly linked list is a common data structure that, when empty, has a pointer pointing to itself.
Self-referential structures can be optimized in accordance with all the usual rules. If there are no other references to them, they can be optimized away. (This optimization is implemented by using a flood fill to mark everything that’s used, and then removing everything else, so that circular references need no special treatment.)
Yeah, I suppose you're right. I was Googling potential interesting cases and ran across this one[1] which made me think of weird edge cases w.r.t. self-reference.
[1] https://stackoverflow.com/questions/20596856/self-referentia...