diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2023-01-14 23:40:02 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2023-02-17 08:23:41 +0000 |
commit | bd2de6fc0604a9990dd70c2603004d3062842d9e (patch) | |
tree | 48f8100210984c3c3b50676fa10ef2e35ae04795 /Source | |
parent | cac16bf94dc041d5f28e2e0fdfa1ae880d801d58 (diff) | |
download | swig-bd2de6fc0604a9990dd70c2603004d3062842d9e.tar.gz |
Fix deduction of partially specialized template parameters
when the specialized parameter is non-trivial, used in a wrapped method
and the type to %template uses typedefs. For example:
typedef double & DoubleRef;
template <typename T> struct XX {};
template <typename T> struct XX<T &> { void fn(T t) {} };
%template(XXD) XX<DoubleRef>;
The type of the parameter in the instantiated template for fn is now correctly deduced
as double.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CParse/templ.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Source/CParse/templ.c b/Source/CParse/templ.c index 718e5ddb8..7a4d0cf4f 100644 --- a/Source/CParse/templ.c +++ b/Source/CParse/templ.c @@ -452,10 +452,12 @@ int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab ptype = Getattr(p, "type"); tptype = Getattr(tp, "type"); if (ptype && tptype) { - partial_type = partial_arg(tptype, ptype); + SwigType *ty = Swig_symbol_typedef_reduce(tptype, tscope); + partial_type = partial_arg(ty, ptype); /* Printf(stdout,"partial '%s' '%s' ---> '%s'\n", tptype, ptype, partial_type); */ Setattr(tp, "type", partial_type); Delete(partial_type); + Delete(ty); } p = nextSibling(p); tp = nextSibling(tp); |