C++: Limit typedef resolving depth

This reverts commit 5be56c0 except for its tests. While it fixed the
problem described in the bug report, it also introduced regressions.

For now, we use a hard limit.

Change-Id: I19a85be454e3d7969371707e3eb1c3d42a16ecee
Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>