Fix seg fault using %template
Fix seg fault when instantiating templates with parameters that are function
parameters containing templates, such as:
%template(MyC) C<int(std::vector<int>)>;
Closes #983
This commit is contained in:
parent
2fc0edc4fd
commit
b18b75369c
4 changed files with 60 additions and 1 deletions
28
Examples/test-suite/template_function_parm.i
Normal file
28
Examples/test-suite/template_function_parm.i
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
%module template_function_parm
|
||||
|
||||
%include <std_vector.i>
|
||||
|
||||
%{
|
||||
#include <numeric>
|
||||
static int accumulate_integers(std::vector<int> vi) {
|
||||
int sum = std::accumulate(vi.begin(), vi.end(), 0);
|
||||
return sum;
|
||||
}
|
||||
%}
|
||||
|
||||
%inline %{
|
||||
template<typename A>
|
||||
struct C {
|
||||
int take_function(int fp(std::vector<int>), std::vector<int> v) {
|
||||
return fp(v);
|
||||
}
|
||||
};
|
||||
%}
|
||||
|
||||
%constant int accumulate_integers(std::vector<int>);
|
||||
|
||||
%template(VectorInt) std::vector<int>;
|
||||
|
||||
// seg fault #983
|
||||
%template(MyC) C<int(std::vector<int>)>;
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue