diff --git a/CHANGES.current b/CHANGES.current index c2ce13d66..70914fb2f 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,6 +1,10 @@ Version 1.3.40 (in progress) ============================ +2009-08-15: wsfulton + Fix %template seg fault on some cases of overloading the templated method. + Bug reported by Jan Kupec. + 2009-08-15: wsfulton [Ruby] Add numerous missing wrapped methods for std::vector specialization as reported by Youssef Jones. diff --git a/Examples/test-suite/java/template_methods_runme.java b/Examples/test-suite/java/template_methods_runme.java index cc179aa49..14256b6be 100644 --- a/Examples/test-suite/java/template_methods_runme.java +++ b/Examples/test-suite/java/template_methods_runme.java @@ -32,6 +32,13 @@ public class template_methods_runme { k.KlassTMethodBool(); b = Klass.KlassStaticTMethodBoolRenamed(true); Klass.KlassStaticTMethodBool(); + + + // + ComponentProperties cp = new ComponentProperties(); + cp.adda("key1", "val1", "key2", 22.2); + cp.adda("key1", "val1", "key2", "val2", "key3", "val3"); + cp.adda("key1", 1, "key2", 2, "key3", 3); } } diff --git a/Examples/test-suite/template_methods.i b/Examples/test-suite/template_methods.i index efd7e3707..8524d5b44 100644 --- a/Examples/test-suite/template_methods.i +++ b/Examples/test-suite/template_methods.i @@ -5,6 +5,8 @@ %warnfilter(SWIGWARN_LANG_TEMPLATE_METHOD_IGNORE) convolve1(); %warnfilter(SWIGWARN_LANG_TEMPLATE_METHOD_IGNORE) convolve3(); +%include + /////////////////// %ignore convolve1(float a); @@ -76,3 +78,23 @@ struct Klass { %template(KlassTMethodBool) Klass::tmethod; %template(KlassStaticTMethodBool) Klass::statictmethod; +//////////////////////////////////////////////////////////////////////////// + +%inline %{ + class ComponentProperties{ + public: + ComponentProperties() {} + ~ComponentProperties() {} + + template void adda(std::string key, T1 val) {} + template void adda(std::string key1, T1 val1, std::string key2, T2 val2) {} + template void adda(std::string key1, T1 val1, std::string key2, T2 val2, std::string key3, T3 val3) {} + }; +%} + +%extend ComponentProperties { + %template(adda) adda; + %template(adda) adda; // ERROR OCCURS HERE + %template(adda) adda; +} + diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index a4787bf4a..7c33e5459 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -2726,7 +2726,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va Parm *ti = targs; String *tv = Getattr(tp,"value"); if (!tv) tv = Getattr(tp,"type"); - while(pi != tp) { + while(pi != tp && ti && pi) { String *name = Getattr(ti,"name"); String *value = Getattr(pi,"value"); if (!value) value = Getattr(pi,"type");