Typemap change for templates

For templates only, the template parameters are fully resolved when
handling typemaps. Without this, it is too hard to have decent rules
to apply typemaps when parameter types are typedef'd and template
parameters have default values.

Fixes %clear for typedefs in templates, eg:

  %typemap("in") XXX<int>::Long "..."
  template typename<T> struct XXX {
    typedef long Long;
  };
  %clear XXX<int>::Long;

as the typemap was previously incorrectly stored as a typemap for long
instead of XXX<int>::Long.
This commit is contained in:
William S Fulton 2017-07-17 07:23:23 +01:00
commit aa2932f409
3 changed files with 132 additions and 2 deletions

View file

@ -0,0 +1,32 @@
from typemap_template_typedef import *
def check(got, expected):
if got != expected:
raise RuntimeError("got: " + str(got) + " expected: " + str(expected))
x = XXXInt()
check(x.aa1(0), 0)
check(x.aa2(0), 55)
check(x.aa3(0), 0)
check(aa1(0), 0)
check(aa2(0), 0)
check(x.bb1(0), 0)
check(x.bb2(0), 66)
check(x.bb3(0), 0)
check(bb1(0), 0)
check(bb2(0), 0)
check(x.cc1(0), 0)
check(x.cc2(0), 77)
check(x.cc3(0), 77)
check(cc1(0), 0)
check(cc2(0), 0)
check(x.dd1(0), 0)
check(x.dd2(0), 88)
check(x.dd3(0), 0)
check(dd1(0), 0)
check(dd2(0), 0)