diff --git a/dtool/src/interrogate/interrogateBuilder.cxx b/dtool/src/interrogate/interrogateBuilder.cxx index 4735157d1d..f06d6e10d0 100644 --- a/dtool/src/interrogate/interrogateBuilder.cxx +++ b/dtool/src/interrogate/interrogateBuilder.cxx @@ -1074,6 +1074,10 @@ scan_function(CPPInstance *function) { return; } + if (TypeManager::involves_rvalue_reference(ftype)) { + return; + } + get_function(function, "", nullptr, scope, InterrogateFunction::F_global); @@ -2986,6 +2990,9 @@ define_method(CPPInstance *function, InterrogateType &itype, // If it isn't, we should publish this method anyway. } + if (TypeManager::involves_rvalue_reference(ftype)) { + return; + } FunctionIndex index = get_function(function, "", struct_type, scope, 0); if (index != 0) { diff --git a/dtool/src/interrogate/typeManager.cxx b/dtool/src/interrogate/typeManager.cxx index dba10f4520..828a33ef53 100644 --- a/dtool/src/interrogate/typeManager.cxx +++ b/dtool/src/interrogate/typeManager.cxx @@ -2015,6 +2015,46 @@ involves_protected(CPPType *type) { } } +/** + * Returns true if the type involves an rvalue reference. + */ +bool TypeManager:: +involves_rvalue_reference(CPPType *type) { + switch (type->get_subtype()) { + case CPPDeclaration::ST_const: + return involves_rvalue_reference(type->as_const_type()->_wrapped_around); + + case CPPDeclaration::ST_reference: + return type->as_reference_type()->_value_category == CPPReferenceType::VC_rvalue; + + case CPPDeclaration::ST_pointer: + return involves_rvalue_reference(type->as_pointer_type()->_pointing_at); + + case CPPDeclaration::ST_function: + { + CPPFunctionType *ftype = type->as_function_type(); + if (involves_rvalue_reference(ftype->_return_type)) { + return true; + } + const CPPParameterList::Parameters ¶ms = + ftype->_parameters->_parameters; + CPPParameterList::Parameters::const_iterator pi; + for (pi = params.begin(); pi != params.end(); ++pi) { + if (involves_rvalue_reference((*pi)->_type)) { + return true; + } + } + return false; + } + + case CPPDeclaration::ST_typedef: + return involves_rvalue_reference(type->as_typedef_type()->_type); + + default: + return false; + } +} + /** * Returns the type this pointer type points to. */ diff --git a/dtool/src/interrogate/typeManager.h b/dtool/src/interrogate/typeManager.h index f1aa2908b1..e9161dbd31 100644 --- a/dtool/src/interrogate/typeManager.h +++ b/dtool/src/interrogate/typeManager.h @@ -118,6 +118,7 @@ public: static bool is_handle(CPPType *type); static bool involves_unpublished(CPPType *type); static bool involves_protected(CPPType *type); + static bool involves_rvalue_reference(CPPType *type); static bool is_ostream(CPPType *type); static bool is_pointer_to_ostream(CPPType *type);