Does your compiler support all C++11 standards?
The const char* what_arg argument in out_of_range added to C++11 as seen here 1.
I’ve never used macOS, but I assume you are compiling with clang? If so, which version are you using?