From 0cfd700c100266af490259333cdf906233cee85f Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Mon, 27 Feb 2006 16:58:01 +0000 Subject: [PATCH] use reduced type in templates when it is a pointer,array,reference or when using the templatereduce option git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8908 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/CParse/parser.y | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 72f0c7737..d95dd6dfe 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -2530,17 +2530,12 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va if (!value) { SwigType *ty = Getattr(p,k_type); if (ty) { - if (template_reduce) { - SwigType *rty = Swig_symbol_typedef_reduce(ty,tscope); - ty = Swig_symbol_type_qualify(rty,tscope); - Setattr(p,k_type,ty); - Delete(ty); - Delete(rty); - } else { - ty = Swig_symbol_type_qualify(ty,tscope); - Setattr(p,k_type,ty); - Delete(ty); - } + SwigType *rty = Swig_symbol_typedef_reduce(ty,tscope); + int reduce = template_reduce || SwigType_ispointer(rty) || SwigType_isarray(rty) || SwigType_isreference(rty); + ty = reduce ? Swig_symbol_type_qualify(rty,tscope) : Swig_symbol_type_qualify(ty,tscope); + Setattr(p,k_type,ty); + Delete(ty); + Delete(rty); } } else { value = Swig_symbol_type_qualify(value,tscope);