Refactor C++ compiler type checking routines