Fix abort using template default parameters

Closes #280
This commit is contained in:
William S Fulton 2014-12-28 10:29:56 +00:00
parent eec306c228
commit ee35389d22
4 changed files with 58 additions and 6 deletions

View File

@ -5,6 +5,10 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 3.0.3 (in progress)
===========================
2014-12-27: wsfulton
Fix #280 - abort using all default template parameters within other template
parameters.
2014-12-27: talby
[Perl] Issue #282 perl5 archlib vs archlibexp
[Perl] tidy "warning: duplicate 'extern' declaration specifier" when building generated code under clang

View File

@ -45,6 +45,11 @@ public class template_default_class_parms_runme {
foo.setTType(a);
a = foo.method(a);
}
{
MapDefaults md = new MapDefaults();
md.test_func(10, 20, new DefaultNodeType());
}
}
}

View File

@ -31,3 +31,46 @@ namespace Space {
%template(FooAnotherType) Space::Foo<Space::AnotherType>;
%template() Space::ATemplate<>;
// Github issue #280 segfault
%inline %{
namespace Teuchos {
class Describable {};
}
namespace KokkosClassic {
namespace DefaultNode {
struct DefaultNodeType {};
};
}
namespace Tpetra {
template <class LocalOrdinal = int,
class GlobalOrdinal = LocalOrdinal,
class Node = KokkosClassic::DefaultNode::DefaultNodeType>
class Map : public Teuchos::Describable {
public:
typedef LocalOrdinal local_ordinal_type;
typedef GlobalOrdinal global_ordinal_type;
typedef Node node_type;
void test_func(LocalOrdinal, GlobalOrdinal, Node) {}
};
}
%}
%template(MapDefaults) Tpetra::Map<>;
%inline %{
namespace Details {
template < class LO = ::Tpetra::Map<>::local_ordinal_type,
class GO = typename ::Tpetra::Map<LO>::global_ordinal_type,
class NT = typename ::Tpetra::Map<LO, GO>::node_type >
class Transfer : public Teuchos::Describable {
public:
void transfer_func(LO, GO, NT) {}
};
}
%}
// Below is not resolving correctly yet
%template(TransferDefaults) Details::Transfer<>;

View File

@ -1875,15 +1875,15 @@ ParmList *Swig_symbol_template_defargs(Parm *parms, Parm *targs, Symtab *tscope,
Delete(ntq);
ntq = ty;
}
/* Printf(stderr,"value %s %s %s\n",value,ntr,ntq); */
cp = NewParmWithoutFileLineInfo(ntq, 0);
if (lp)
set_nextSibling(lp, cp);
else
expandedparms = CopyParm(cp);
if (lp) {
set_nextSibling(lp, cp);
Delete(cp);
} else {
expandedparms = cp;
}
lp = cp;
tp = nextSibling(tp);
Delete(cp);
Delete(nt);
Delete(ntq);
} else {