diff --git a/CHANGES.current b/CHANGES.current index 7e6dcdadc..e89fe79f0 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -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 diff --git a/Examples/test-suite/java/template_default_class_parms_runme.java b/Examples/test-suite/java/template_default_class_parms_runme.java index 406915b82..0a6571fa8 100644 --- a/Examples/test-suite/java/template_default_class_parms_runme.java +++ b/Examples/test-suite/java/template_default_class_parms_runme.java @@ -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()); + } } } diff --git a/Examples/test-suite/template_default_class_parms.i b/Examples/test-suite/template_default_class_parms.i index cd37269d3..8784bb1b4 100644 --- a/Examples/test-suite/template_default_class_parms.i +++ b/Examples/test-suite/template_default_class_parms.i @@ -31,3 +31,46 @@ namespace Space { %template(FooAnotherType) Space::Foo; %template() Space::ATemplate<>; + + +// Github issue #280 segfault +%inline %{ +namespace Teuchos { + class Describable {}; +} +namespace KokkosClassic { + namespace DefaultNode { + struct DefaultNodeType {}; + }; +} + +namespace Tpetra { + template + 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::global_ordinal_type, + class NT = typename ::Tpetra::Map::node_type > + class Transfer : public Teuchos::Describable { + public: + void transfer_func(LO, GO, NT) {} + }; +} +%} + +// Below is not resolving correctly yet +%template(TransferDefaults) Details::Transfer<>; diff --git a/Source/Swig/symbol.c b/Source/Swig/symbol.c index e77f818de..2202f61c6 100644 --- a/Source/Swig/symbol.c +++ b/Source/Swig/symbol.c @@ -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 {