Hi all !

We’ve been using Swig 2.0.0 for years, and we try to go to Swig 3.x for C++11 compatibility.

 

I found a regression about template+namespace:

 

%module test

 

namespace ns {

  template <class T>

  struct Wrap

  {};

 

  template <class T>

  struct Array

  {};

 

%template (Wrapf) Wrap<float>;

typedef Wrap<float> Wrapf;

 

%template (Arrayf) Array<Wrapf>;

typedef Array<Wrapf> Arrayf;

 

}

 

The _wrap_new_Arrayf generated function returns a SWIGTYPE_p_ns__ArrayT_ns__Wrapf_t type, instead of the former SWIGTYPE_p_ns__ArrayT_ns__WrapT_float_t_t.

 

It works when there is no namespace. (generates SWIGTYPE_p_ArrayT_WrapT_float_t_t)

 

And when the %template directive is not in the namespace scope:

 

%module test

 

namespace ns {

 

  template <class T>

  struct Wrap

  {};

 

  template <class T>

  struct Array

  {};

 

  typedef Wrap<float> Wrapf;

  typedef Array<Wrapf> Arrayf;

}

 

%template (Wrapf) ns::Wrap<float>;

%template (Arrayf) ns::Array<ns::Wrapf>;

 

 

 

Is it a bug, or %template is not intended to be used in a namespace scope ?

 

Thanks for your continuous work on this lifesaver of Swig ! J

 

 

Guillaume