solve duplicate symbol issue reported by Andreas Held

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8744 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-02-08 02:06:15 +00:00
commit 8b9a7ae769
2 changed files with 18 additions and 12 deletions

View file

@ -146,17 +146,22 @@ class Allocate : public Dispatcher {
// 3) a non-matching method (ie an overloaded method of some sort) // 3) a non-matching method (ie an overloaded method of some sort)
// 4) a matching method which is not polymorphic, ie it hides the base class' method // 4) a matching method which is not polymorphic, ie it hides the base class' method
// Check if fully resolved return types match (including covariant return types) // Check if fully resolved return types match (including
String *this_returntype = function_return_type(n); // covariant return types)
String *base_returntype = function_return_type(base);
returntype_match = Strcmp(this_returntype, base_returntype) == 0 ? true : false;
if (!returntype_match) { if (!returntype_match) {
covariant_returntype = SwigType_issubtype(this_returntype, base_returntype) ? true : false; String *this_returntype = function_return_type(n);
returntype_match = covariant_returntype; String *base_returntype = function_return_type(base);
returntype_match = Strcmp(this_returntype, base_returntype) == 0 ? true : false;
if (!returntype_match) {
covariant_returntype = SwigType_issubtype(this_returntype, base_returntype) ? true : false;
returntype_match = covariant_returntype;
}
Delete(this_returntype);
Delete(base_returntype);
} }
// The return types must match at this point, for the whole method to match // The return types must match at this point, for the whole method to match
if (returntype_match) { if (returntype_match && !decl_match) {
// Now need to check the parameter list // Now need to check the parameter list
// First do an inexpensive parameter count // First do an inexpensive parameter count
ParmList *this_parms = Getattr(n,"parms"); ParmList *this_parms = Getattr(n,"parms");
@ -181,9 +186,8 @@ class Allocate : public Dispatcher {
Delete(this_fn); Delete(this_fn);
} }
} }
Delete(this_returntype);
Delete(base_returntype);
} }
//Printf(stderr,"look %s %s %d %d\n",base_decl, this_decl, returntype_match, decl_match);
if (decl_match && returntype_match) { if (decl_match && returntype_match) {
// Found an identical method in the base class // Found an identical method in the base class
@ -283,9 +287,10 @@ class Allocate : public Dispatcher {
if (is_member_director(classnode, member)) if (is_member_director(classnode, member))
virtual_elimination_mode = 0; virtual_elimination_mode = 0;
if (function_is_defined_in_bases(member, bases)) if (function_is_defined_in_bases(member, bases)) {
defined = 1; defined = 1;
}
virtual_elimination_mode = old_mode; virtual_elimination_mode = old_mode;
} }

View file

@ -765,8 +765,9 @@ int Language::cDeclaration(Node *n) {
if (!isfriend ) { if (!isfriend ) {
/* we check what director needs. If the method is pure virtual, /* we check what director needs. If the method is pure virtual,
it is always needed. */ it is always needed. */
if (!(directorsEnabled() && is_member_director(CurrentClass,n) && need_nonpublic_member(n))) if (!(directorsEnabled() && Getattr(n,"director")) ) {
return SWIG_NOWRAP; return SWIG_NOWRAP;
}
} }
} }