From bf7eb7d50d956564eafd4e32976a2e1dd9bfdcc6 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 30 Nov 2004 20:13:31 +0000 Subject: [PATCH] Complete the virtual:type for covariant return types git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6797 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/allocate.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Source/Modules/allocate.cxx b/Source/Modules/allocate.cxx index 2e0345a68..f7f6ae435 100644 --- a/Source/Modules/allocate.cxx +++ b/Source/Modules/allocate.cxx @@ -114,9 +114,16 @@ class Allocate : public Dispatcher { if (strcmp(la, ba) == 0) Setattr(c,"feature:ignore", "1"); } } else { - // if the types are different, we record the original - // virtual base type in case some language needs it. - Setattr(c, "virtual:type", Getattr(temp, "type")); + // if the types are different, we record the base type + // those languages that need to know about covariant return types + SwigType *ty = NewString(Getattr(temp,"type")); + SwigType_push(ty,Getattr(temp,"decl")); + if (SwigType_isqualifier(ty)) { + SwigType_pop(ty); + } + Delete(SwigType_pop_function(ty)); + + Setattr(c, "virtual:type", ty); } Delete(base_decl);