Can we diagnose this?

Slide 11 of <http://miek.nl/downloads/2010/c++-talk.pdf> shows the
following code as sending the compiler into an infloop:

template<class T> struct Loop { Loop<T*> operator->(); };
Loop<int> i, j = i->hooray;

I just verified that clang does go into an infloop for this and
clang's resident memory starts growing without bound. Is there some
way for us to detect this and properly diagnose?

Also, I'll file a PR to track this unless somebody knows if we already
have a PR for it or we deliberately don't do anything about this
behavior.

-- Sean Silva

This is PR9619 and duplicates. There are really two problems here: we allow arbitrarily complex types to be created then hit a stack overflow when processing them, and we don’t restrict the depth of operator-> chains we will follow (except when there is a cycle).