Every now and again you hear someone complaining about the difficulty of parsing C++. You will probably also have heard that templates are Turing complete. The two statements are of course linked; the following code is valid C++, but will never compile.
#include <iostream>
template <unsigned n>
struct Forever {
enum { value = Forever<n+1>::value };
};
int main ()
{
std::cout << Forever<1>::value << "\n";
}
g++ bails out at the 500th recursion with the error message:
forever.cpp:9: error: template instantiation depth exceeds maximum of 500 (use -ftemplate-depth-NN to increase the maximum) instantiating 'struct Forever<501u>'
I've omitted the five-hundred line long trace back through the other templates.