From 8b9a7ae7699ea791722aa3c30abda01e1460862b Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Wed, 8 Feb 2006 02:06:15 +0000 Subject: [PATCH] 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 --- Source/Modules/allocate.cxx | 27 ++++++++++++++++----------- Source/Modules/lang.cxx | 3 ++- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Source/Modules/allocate.cxx b/Source/Modules/allocate.cxx index ee7f89b70..065cebc15 100644 --- a/Source/Modules/allocate.cxx +++ b/Source/Modules/allocate.cxx @@ -146,17 +146,22 @@ class Allocate : public Dispatcher { // 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 - // Check if fully resolved return types match (including covariant return types) - String *this_returntype = function_return_type(n); - String *base_returntype = function_return_type(base); - returntype_match = Strcmp(this_returntype, base_returntype) == 0 ? true : false; + // Check if fully resolved return types match (including + // covariant return types) if (!returntype_match) { - covariant_returntype = SwigType_issubtype(this_returntype, base_returntype) ? true : false; - returntype_match = covariant_returntype; + String *this_returntype = function_return_type(n); + 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 - if (returntype_match) { + if (returntype_match && !decl_match) { // Now need to check the parameter list // First do an inexpensive parameter count ParmList *this_parms = Getattr(n,"parms"); @@ -181,9 +186,8 @@ class Allocate : public Dispatcher { 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) { // Found an identical method in the base class @@ -283,9 +287,10 @@ class Allocate : public Dispatcher { if (is_member_director(classnode, member)) virtual_elimination_mode = 0; - if (function_is_defined_in_bases(member, bases)) + if (function_is_defined_in_bases(member, bases)) { defined = 1; - + } + virtual_elimination_mode = old_mode; } diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx index 7189845e1..fdcd72ae2 100644 --- a/Source/Modules/lang.cxx +++ b/Source/Modules/lang.cxx @@ -765,8 +765,9 @@ int Language::cDeclaration(Node *n) { if (!isfriend ) { /* we check what director needs. If the method is pure virtual, it is always needed. */ - if (!(directorsEnabled() && is_member_director(CurrentClass,n) && need_nonpublic_member(n))) + if (!(directorsEnabled() && Getattr(n,"director")) ) { return SWIG_NOWRAP; + } } }