Merge branch 'swig-fortran-fix-anonymous-apply-template'
* swig-fortran-fix-anonymous-apply-template: Fix failure of %apply directive in anonymous templates Add test showing typemap failure
This commit is contained in:
commit
ed45d2835f
2 changed files with 26 additions and 2 deletions
|
|
@ -27,7 +27,7 @@ template<typename T> struct TemplateTest1 {
|
|||
%template(TTint) TemplateTest1< int >;
|
||||
|
||||
%inline %{
|
||||
void extratest(const TemplateTest1< YY > &t,
|
||||
void extratest(const TemplateTest1< YY > &t,
|
||||
const TemplateTest1< ZZ > &tt,
|
||||
const TemplateTest1< int > &ttt)
|
||||
{}
|
||||
|
|
@ -38,3 +38,27 @@ template<typename T> struct TemplateTest1 {
|
|||
%inline %{
|
||||
void wasbug(TemplateTest1< int >::Double wbug) {}
|
||||
%}
|
||||
|
||||
/* Test bug where the %apply directive was ignored inside anonymous template
|
||||
* instantiations */
|
||||
|
||||
template<class T>
|
||||
struct Foo {
|
||||
%typemap(in) Foo<T> ""
|
||||
%apply Foo<T> { const Foo<T> & }
|
||||
};
|
||||
|
||||
%{
|
||||
template<class T> struct Foo {};
|
||||
%}
|
||||
|
||||
%template(Foo_int) Foo<int>;
|
||||
%template() Foo<double>;
|
||||
|
||||
%inline %{
|
||||
void this_works(Foo<int> f) {}
|
||||
void this_also_works(const Foo<int>& f) {}
|
||||
void this_also_also_works(Foo<double> f) {}
|
||||
void this_used_to_fail(const Foo<double>& f) {}
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -2962,7 +2962,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
Swig_cparse_template_expand(templnode,nname,temparms,tscope);
|
||||
Setattr(templnode,"sym:name",nname);
|
||||
Delete(nname);
|
||||
Setattr(templnode,"feature:onlychildren", "typemap,typemapitem,typemapcopy,typedef,types,fragment");
|
||||
Setattr(templnode,"feature:onlychildren", "typemap,typemapitem,typemapcopy,typedef,types,fragment,apply");
|
||||
if ($3) {
|
||||
Swig_warning(WARN_PARSE_NESTED_TEMPLATE, cparse_file, cparse_line, "Named nested template instantiations not supported. Processing as if no name was given to %%template().\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue