fix crash during C++ class type inference