This resulted in a codegen error in C++ mode, because the generic types were not defined in modules where calls requiring downcasts were used (generating a downcast forces the inclusion of the full definition of the involved types).