From b6a927c84cc5a420acd79103377934c933e4b064 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Thu, 20 Oct 2005 15:42:48 +0000 Subject: [PATCH] fix bug #1292926 git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7698 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/virtual_derivation.i | 13 +++++++++++++ Source/Modules/allocate.cxx | 23 +++++++++++++---------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/Examples/test-suite/virtual_derivation.i b/Examples/test-suite/virtual_derivation.i index caddadc7f..a199646d4 100644 --- a/Examples/test-suite/virtual_derivation.i +++ b/Examples/test-suite/virtual_derivation.i @@ -51,4 +51,17 @@ // declaration: // using A::get_a; }; + + + + + class IndexReader{ + public: + virtual void norms() = 0; + }; + + class MultiReader : public IndexReader { + protected: + MultiReader(); + }; %} diff --git a/Source/Modules/allocate.cxx b/Source/Modules/allocate.cxx index 07a77064a..73aea314c 100644 --- a/Source/Modules/allocate.cxx +++ b/Source/Modules/allocate.cxx @@ -310,7 +310,9 @@ class Allocate : public Dispatcher { } List *abstract = Getattr(base,"abstract"); if (abstract) { - for (int i = 0; i < Len(abstract); i++) { + int dabstract = 0; + int len = Len(abstract); + for (int i = 0; i < len; i++) { Node *nn = Getitem(abstract,i); String *name = Getattr(nn,"name"); if (!name) continue; @@ -326,17 +328,19 @@ class Allocate : public Dispatcher { Delete(base_decl); if (!dn) { - List *abstract = Getattr(n,"abstract"); - if (!abstract) { - abstract = NewList(); - Setattr(n,"abstract",abstract); - } else { - if (!Getattr(n,"abstract:firstnode")) - Setattr(n,"abstract:firstnode",nn); + List *nabstract = Getattr(n,"abstract"); + if (!nabstract) { + nabstract = NewList(); + Setattr(n,"abstract",nabstract); } - Append(abstract,nn); + Append(nabstract,nn); + if (!Getattr(n,"abstract:firstnode")) { + Setattr(n,"abstract:firstnode",nn); + } + dabstract = base != n; } } + if (dabstract) return 1; } List *bases = Getattr(base,"allbases"); if (!bases) return 0; @@ -537,7 +541,6 @@ public: /* Check if the class is abstract via inheritance. This might occur if a class didn't have any pure virtual methods of its own, but it didn't implement all of the pure methods in a base class */ - if (!Getattr(n,"abstract") && is_abstract_inherit(n)) { if (((Getattr(n,"allocate:public_constructor") || (!GetFlag(n,"feature:nodefault") && !Getattr(n,"allocate:has_constructor"))))) { if (!GetFlag(n,"feature:notabstract")) {