I noticed that clang++ includes a missing header -
using namespace std;
cout << "int max: " << numeric_limits<int>::max() << endl;
In C++, unlike C, standard headers are allowed to
#include other standard headers. That sometimes leads to mysterious errors like the ones you're seeing: one compiler's
<limits> and the other doesn't. The solution is to always include the headers needed for whatever names you use. In this case that means to
#include <limits> in your code, even though it compiles okay as is with one compiler. There's no harm in
#include a header that's already been pulled in, so that's okay with both compilers. It's annoying sometimes, but that's just the way things are.