diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2022-09-17 10:23:51 +0100 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2022-09-17 10:23:51 +0100 |
commit | e97181ebc07a4755c1ab3e6f08eef12a3f9de07e (patch) | |
tree | 16dc71ce60c3a97a93976af5fdd5e86482aaa8c1 | |
parent | f0af17b3244d98109a62e3fda5ab6e5fc458283d (diff) | |
download | swig-e97181ebc07a4755c1ab3e6f08eef12a3f9de07e.tar.gz |
Add missing typecheck typemaps for std::auto_ptr and std::unique_ptr
To fix overloading when using these types.
59 files changed, 442 insertions, 2 deletions
diff --git a/CHANGES.current b/CHANGES.current index dd808d37f..6fe039d30 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -8,6 +8,10 @@ Version 4.1.0 (in progress) =========================== 2022-09-17: wsfulton + Add missing typecheck typemaps for std::auto_ptr and std::unique_ptr to + fix overloading when using these types. + +2022-09-17: wsfulton [Guile] Add error checking to SWIGTYPE and SWIGTYPE & in typemaps to prevent seg faults when passing #nil to these parameter types. diff --git a/Examples/test-suite/cpp11_std_unique_ptr.i b/Examples/test-suite/cpp11_std_unique_ptr.i index f1ff84aae..f360d8cf3 100644 --- a/Examples/test-suite/cpp11_std_unique_ptr.i +++ b/Examples/test-suite/cpp11_std_unique_ptr.i @@ -2,6 +2,8 @@ #if !(defined(SWIGGO) || defined(SWIGOCAML) || defined(SWIGR) || defined(SWIGSCILAB)) +%warnfilter(509, 516) overloadTest(Klass); + %include "std_string.i" %include "std_unique_ptr.i" @@ -88,6 +90,18 @@ std::unique_ptr<Klass> makeNullUniquePtr() { return std::unique_ptr<Klass>(); } +int overloadTest() { + return 0; +} + +int overloadTest(std::unique_ptr<Klass> kover) { + return 1; +} + +int overloadTest(Klass k) { + return 2; +} + %} #endif diff --git a/Examples/test-suite/csharp/cpp11_std_unique_ptr_runme.cs b/Examples/test-suite/csharp/cpp11_std_unique_ptr_runme.cs index 04fafae42..7d905e08b 100644 --- a/Examples/test-suite/csharp/cpp11_std_unique_ptr_runme.cs +++ b/Examples/test-suite/csharp/cpp11_std_unique_ptr_runme.cs @@ -91,6 +91,15 @@ public class cpp11_std_unique_ptr_runme { cpp11_std_unique_ptr.takeKlassUniquePtr(cpp11_std_unique_ptr.make_null()); checkCount(0); + // overloaded parameters + if (cpp11_std_unique_ptr.overloadTest() != 0) + throw new ApplicationException("overloadTest failed"); + if (cpp11_std_unique_ptr.overloadTest(null) != 1) + throw new ApplicationException("overloadTest failed"); + if (cpp11_std_unique_ptr.overloadTest(new Klass("over")) != 1) + throw new ApplicationException("overloadTest failed"); + checkCount(0); + // unique_ptr as output Klass k1 = cpp11_std_unique_ptr.makeKlassUniquePtr("first"); diff --git a/Examples/test-suite/csharp/li_std_auto_ptr_runme.cs b/Examples/test-suite/csharp/li_std_auto_ptr_runme.cs index a11b57fec..bc5c77608 100644 --- a/Examples/test-suite/csharp/li_std_auto_ptr_runme.cs +++ b/Examples/test-suite/csharp/li_std_auto_ptr_runme.cs @@ -91,6 +91,15 @@ public class li_std_auto_ptr_runme { li_std_auto_ptr.takeKlassAutoPtr(li_std_auto_ptr.make_null()); checkCount(0); + // overloaded parameters + if (li_std_auto_ptr.overloadTest() != 0) + throw new ApplicationException("overloadTest failed"); + if (li_std_auto_ptr.overloadTest(null) != 1) + throw new ApplicationException("overloadTest failed"); + if (li_std_auto_ptr.overloadTest(new Klass("over")) != 1) + throw new ApplicationException("overloadTest failed"); + checkCount(0); + // auto_ptr as output Klass k1 = li_std_auto_ptr.makeKlassAutoPtr("first"); diff --git a/Examples/test-suite/d/cpp11_std_unique_ptr_runme.1.d b/Examples/test-suite/d/cpp11_std_unique_ptr_runme.1.d index b83392a85..b8e466414 100644 --- a/Examples/test-suite/d/cpp11_std_unique_ptr_runme.1.d +++ b/Examples/test-suite/d/cpp11_std_unique_ptr_runme.1.d @@ -91,6 +91,15 @@ void main() { takeKlassUniquePtr(make_null()); checkCount(0); + // overloaded parameters + if (overloadTest() != 0) + throw new Exception("overloadTest failed"); + if (overloadTest(null) != 1) + throw new Exception("overloadTest failed"); + if (overloadTest(new Klass("over")) != 1) + throw new Exception("overloadTest failed"); + checkCount(0); + // unique_ptr as output Klass k1 = makeKlassUniquePtr("first"); diff --git a/Examples/test-suite/d/cpp11_std_unique_ptr_runme.2.d b/Examples/test-suite/d/cpp11_std_unique_ptr_runme.2.d index b83392a85..b8e466414 100644 --- a/Examples/test-suite/d/cpp11_std_unique_ptr_runme.2.d +++ b/Examples/test-suite/d/cpp11_std_unique_ptr_runme.2.d @@ -91,6 +91,15 @@ void main() { takeKlassUniquePtr(make_null()); checkCount(0); + // overloaded parameters + if (overloadTest() != 0) + throw new Exception("overloadTest failed"); + if (overloadTest(null) != 1) + throw new Exception("overloadTest failed"); + if (overloadTest(new Klass("over")) != 1) + throw new Exception("overloadTest failed"); + checkCount(0); + // unique_ptr as output Klass k1 = makeKlassUniquePtr("first"); diff --git a/Examples/test-suite/d/li_std_auto_ptr_runme.1.d b/Examples/test-suite/d/li_std_auto_ptr_runme.1.d index 3ad86dc61..86fac68b5 100644 --- a/Examples/test-suite/d/li_std_auto_ptr_runme.1.d +++ b/Examples/test-suite/d/li_std_auto_ptr_runme.1.d @@ -91,6 +91,15 @@ void main() { takeKlassAutoPtr(make_null()); checkCount(0); + // overloaded parameters + if (overloadTest() != 0) + throw new Exception("overloadTest failed"); + if (overloadTest(null) != 1) + throw new Exception("overloadTest failed"); + if (overloadTest(new Klass("over")) != 1) + throw new Exception("overloadTest failed"); + checkCount(0); + // auto_ptr as output Klass k1 = makeKlassAutoPtr("first"); diff --git a/Examples/test-suite/d/li_std_auto_ptr_runme.2.d b/Examples/test-suite/d/li_std_auto_ptr_runme.2.d index 3ad86dc61..86fac68b5 100644 --- a/Examples/test-suite/d/li_std_auto_ptr_runme.2.d +++ b/Examples/test-suite/d/li_std_auto_ptr_runme.2.d @@ -91,6 +91,15 @@ void main() { takeKlassAutoPtr(make_null()); checkCount(0); + // overloaded parameters + if (overloadTest() != 0) + throw new Exception("overloadTest failed"); + if (overloadTest(null) != 1) + throw new Exception("overloadTest failed"); + if (overloadTest(new Klass("over")) != 1) + throw new Exception("overloadTest failed"); + checkCount(0); + // auto_ptr as output Klass k1 = makeKlassAutoPtr("first"); diff --git a/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java b/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java index 6a8b9b8f2..f90ef7041 100644 --- a/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java +++ b/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java @@ -111,6 +111,15 @@ public class cpp11_std_unique_ptr_runme { cpp11_std_unique_ptr.takeKlassUniquePtr(cpp11_std_unique_ptr.make_null()); checkCount(0); + // overloaded parameters + if (cpp11_std_unique_ptr.overloadTest() != 0) + throw new RuntimeException("overloadTest failed"); + if (cpp11_std_unique_ptr.overloadTest(null) != 1) + throw new RuntimeException("overloadTest failed"); + if (cpp11_std_unique_ptr.overloadTest(new Klass("over")) != 1) + throw new RuntimeException("overloadTest failed"); + checkCount(0); + // unique_ptr as output Klass k1 = cpp11_std_unique_ptr.makeKlassUniquePtr("first"); diff --git a/Examples/test-suite/java/li_std_auto_ptr_runme.java b/Examples/test-suite/java/li_std_auto_ptr_runme.java index fd13b9215..24e353ddc 100644 --- a/Examples/test-suite/java/li_std_auto_ptr_runme.java +++ b/Examples/test-suite/java/li_std_auto_ptr_runme.java @@ -111,6 +111,15 @@ public class li_std_auto_ptr_runme { li_std_auto_ptr.takeKlassAutoPtr(li_std_auto_ptr.make_null()); checkCount(0); + // overloaded parameters + if (li_std_auto_ptr.overloadTest() != 0) + throw new RuntimeException("overloadTest failed"); + if (li_std_auto_ptr.overloadTest(null) != 1) + throw new RuntimeException("overloadTest failed"); + if (li_std_auto_ptr.overloadTest(new Klass("over")) != 1) + throw new RuntimeException("overloadTest failed"); + checkCount(0); + // auto_ptr as output Klass k1 = li_std_auto_ptr.makeKlassAutoPtr("first"); diff --git a/Examples/test-suite/javascript/cpp11_std_unique_ptr_runme.js b/Examples/test-suite/javascript/cpp11_std_unique_ptr_runme.js index 8f358a4a7..9e7d87971 100644 --- a/Examples/test-suite/javascript/cpp11_std_unique_ptr_runme.js +++ b/Examples/test-suite/javascript/cpp11_std_unique_ptr_runme.js @@ -94,6 +94,15 @@ cpp11_std_unique_ptr.takeKlassUniquePtr(null); cpp11_std_unique_ptr.takeKlassUniquePtr(cpp11_std_unique_ptr.make_null()); checkCount(0); +// overloaded parameters +if (cpp11_std_unique_ptr.overloadTest() != 0) + throw new RuntimeException("overloadTest failed"); +if (cpp11_std_unique_ptr.overloadTest(null) != 1) + throw new RuntimeException("overloadTest failed"); +if (cpp11_std_unique_ptr.overloadTest(new cpp11_std_unique_ptr.Klass("over")) != 1) + throw new RuntimeException("overloadTest failed"); +checkCount(0); + // unique_ptr as output k1 = cpp11_std_unique_ptr.makeKlassUniquePtr("first"); diff --git a/Examples/test-suite/javascript/li_std_auto_ptr_runme.js b/Examples/test-suite/javascript/li_std_auto_ptr_runme.js index abe659878..715b9aca2 100644 --- a/Examples/test-suite/javascript/li_std_auto_ptr_runme.js +++ b/Examples/test-suite/javascript/li_std_auto_ptr_runme.js @@ -94,6 +94,15 @@ li_std_auto_ptr.takeKlassAutoPtr(null); li_std_auto_ptr.takeKlassAutoPtr(li_std_auto_ptr.make_null()); checkCount(0); +// overloaded parameters +if (li_std_auto_ptr.overloadTest() != 0) + throw new RuntimeException("overloadTest failed"); +if (li_std_auto_ptr.overloadTest(null) != 1) + throw new RuntimeException("overloadTest failed"); +if (li_std_auto_ptr.overloadTest(new li_std_auto_ptr.Klass("over")) != 1) + throw new RuntimeException("overloadTest failed"); +checkCount(0); + // auto_ptr as output k1 = li_std_auto_ptr.makeKlassAutoPtr("first"); diff --git a/Examples/test-suite/li_std_auto_ptr.i b/Examples/test-suite/li_std_auto_ptr.i index 6de33f6cf..18df51368 100644 --- a/Examples/test-suite/li_std_auto_ptr.i +++ b/Examples/test-suite/li_std_auto_ptr.i @@ -14,6 +14,8 @@ #if !(defined(SWIGGO) || defined(SWIGOCAML) || defined(SWIGR) || defined(SWIGSCILAB)) +%warnfilter(509, 516) overloadTest(Klass); + %include "std_string.i" //#include <iostream> %include "std_auto_ptr.i" @@ -136,6 +138,18 @@ std::auto_ptr<Klass> makeNullAutoPtr() { return std::auto_ptr<Klass>(); } +int overloadTest() { + return 0; +} + +int overloadTest(std::auto_ptr<Klass> kover) { + return 1; +} + +int overloadTest(Klass k) { + return 2; +} + %} #endif diff --git a/Examples/test-suite/lua/cpp11_std_unique_ptr_runme.lua b/Examples/test-suite/lua/cpp11_std_unique_ptr_runme.lua index e22a09728..88d453e19 100644 --- a/Examples/test-suite/lua/cpp11_std_unique_ptr_runme.lua +++ b/Examples/test-suite/lua/cpp11_std_unique_ptr_runme.lua @@ -81,6 +81,18 @@ cpp11_std_unique_ptr.takeKlassUniquePtr(nil); cpp11_std_unique_ptr.takeKlassUniquePtr(cpp11_std_unique_ptr.make_null()); checkCount(0); +-- overloaded parameters +if not (cpp11_std_unique_ptr.overloadTest() == 0) then + error("overloadTest failed") +end +if not (cpp11_std_unique_ptr.overloadTest(nil) == 1) then + error("overloadTest failed") +end +if not (cpp11_std_unique_ptr.overloadTest(cpp11_std_unique_ptr.Klass("over")) == 1) then + error("overloadTest failed") +end +checkCount(0) + -- unique_ptr as output k1 = cpp11_std_unique_ptr.makeKlassUniquePtr("first") diff --git a/Examples/test-suite/lua/li_std_auto_ptr_runme.lua b/Examples/test-suite/lua/li_std_auto_ptr_runme.lua index d605af692..118a62f01 100644 --- a/Examples/test-suite/lua/li_std_auto_ptr_runme.lua +++ b/Examples/test-suite/lua/li_std_auto_ptr_runme.lua @@ -81,6 +81,18 @@ li_std_auto_ptr.takeKlassAutoPtr(nil); li_std_auto_ptr.takeKlassAutoPtr(li_std_auto_ptr.make_null()); checkCount(0); +-- overloaded parameters +if not (li_std_auto_ptr.overloadTest() == 0) then + error("overloadTest failed") +end +if not (li_std_auto_ptr.overloadTest(nil) == 1) then + error("overloadTest failed") +end +if not (li_std_auto_ptr.overloadTest(li_std_auto_ptr.Klass("over")) == 1) then + error("overloadTest failed") +end +checkCount(0) + -- auto_ptr as output k1 = li_std_auto_ptr.makeKlassAutoPtr("first") diff --git a/Examples/test-suite/mzscheme/cpp11_std_unique_ptr_runme.scm b/Examples/test-suite/mzscheme/cpp11_std_unique_ptr_runme.scm index 5996586af..cd0e18038 100644 --- a/Examples/test-suite/mzscheme/cpp11_std_unique_ptr_runme.scm +++ b/Examples/test-suite/mzscheme/cpp11_std_unique_ptr_runme.scm @@ -79,6 +79,15 @@ (takeKlassUniquePtr (make-null)) (checkCount 0) +; overloaded parameters +(unless (= (overloadTest) 0) + (error "overloadTest failed")) +(unless (= (overloadTest null) 1) + (error "overloadTest failed")) +(unless (= (overloadTest (new-Klass "over")) 1) + (error "overloadTest failed")) +(checkCount 0) + ; unique_ptr as output (define k1 (makeKlassUniquePtr "first")) diff --git a/Examples/test-suite/mzscheme/li_std_auto_ptr_runme.scm b/Examples/test-suite/mzscheme/li_std_auto_ptr_runme.scm index f52829163..c6c43dba0 100644 --- a/Examples/test-suite/mzscheme/li_std_auto_ptr_runme.scm +++ b/Examples/test-suite/mzscheme/li_std_auto_ptr_runme.scm @@ -79,6 +79,15 @@ (takeKlassAutoPtr (make-null)) (checkCount 0) +; overloaded parameters +(unless (= (overloadTest) 0) + (error "overloadTest failed")) +(unless (= (overloadTest null) 1) + (error "overloadTest failed")) +(unless (= (overloadTest (new-Klass "over")) 1) + (error "overloadTest failed")) +(checkCount 0) + ; auto_ptr as output (define k1 (makeKlassAutoPtr "first")) diff --git a/Examples/test-suite/octave/cpp11_std_unique_ptr_runme.m b/Examples/test-suite/octave/cpp11_std_unique_ptr_runme.m index fd72a522b..dbd461711 100644 --- a/Examples/test-suite/octave/cpp11_std_unique_ptr_runme.m +++ b/Examples/test-suite/octave/cpp11_std_unique_ptr_runme.m @@ -100,6 +100,18 @@ takeKlassUniquePtr(null); takeKlassUniquePtr(null_ptr); checkCount(0); +# overloaded parameters +if (overloadTest() != 0) + error("overloadTest failed"); +endif +if (overloadTest(null) != 1) + error("overloadTest failed"); +endif +if (overloadTest(Klass("over")) != 1) + error("overloadTest failed"); +endif +checkCount(0); + # unique_ptr as output k1 = makeKlassUniquePtr("first"); diff --git a/Examples/test-suite/octave/li_std_auto_ptr_runme.m b/Examples/test-suite/octave/li_std_auto_ptr_runme.m index c8d00afbd..9f0dd16cd 100644 --- a/Examples/test-suite/octave/li_std_auto_ptr_runme.m +++ b/Examples/test-suite/octave/li_std_auto_ptr_runme.m @@ -100,6 +100,18 @@ takeKlassAutoPtr(null); takeKlassAutoPtr(null_ptr); checkCount(0); +# overloaded parameters +if (overloadTest() != 0) + error("overloadTest failed"); +endif +if (overloadTest(null) != 1) + error("overloadTest failed"); +endif +if (overloadTest(Klass("over")) != 1) + error("overloadTest failed"); +endif +checkCount(0); + # auto_ptr as output k1 = makeKlassAutoPtr("first"); diff --git a/Examples/test-suite/perl5/cpp11_std_unique_ptr_runme.pl b/Examples/test-suite/perl5/cpp11_std_unique_ptr_runme.pl index 793ba733f..d61964bec 100644 --- a/Examples/test-suite/perl5/cpp11_std_unique_ptr_runme.pl +++ b/Examples/test-suite/perl5/cpp11_std_unique_ptr_runme.pl @@ -1,6 +1,6 @@ use strict; use warnings; -use Test::More tests => 30; +use Test::More tests => 34; BEGIN { use_ok('cpp11_std_unique_ptr') } require_ok('cpp11_std_unique_ptr'); @@ -77,6 +77,12 @@ cpp11_std_unique_ptr::takeKlassUniquePtr(undef); cpp11_std_unique_ptr::takeKlassUniquePtr(cpp11_std_unique_ptr::make_null()); checkCount(0); +# overloaded parameters +is(cpp11_std_unique_ptr::overloadTest(), 0, "overloadTest failed"); +is(cpp11_std_unique_ptr::overloadTest(undef), 1, "overloadTest failed"); +is(cpp11_std_unique_ptr::overloadTest(new cpp11_std_unique_ptr::Klass("over")), 1, "overloadTest failed"); +checkCount(0); + # unique_ptr as output my $k1 = cpp11_std_unique_ptr::makeKlassUniquePtr("first"); diff --git a/Examples/test-suite/perl5/li_std_auto_ptr_runme.pl b/Examples/test-suite/perl5/li_std_auto_ptr_runme.pl index cd68ddedf..bfcd38651 100644 --- a/Examples/test-suite/perl5/li_std_auto_ptr_runme.pl +++ b/Examples/test-suite/perl5/li_std_auto_ptr_runme.pl @@ -1,6 +1,6 @@ use strict; use warnings; -use Test::More tests => 30; +use Test::More tests => 34; BEGIN { use_ok('li_std_auto_ptr') } require_ok('li_std_auto_ptr'); @@ -77,6 +77,12 @@ li_std_auto_ptr::takeKlassAutoPtr(undef); li_std_auto_ptr::takeKlassAutoPtr(li_std_auto_ptr::make_null()); checkCount(0); +# overloaded parameters +is(li_std_auto_ptr::overloadTest(), 0, "overloadTest failed"); +is(li_std_auto_ptr::overloadTest(undef), 1, "overloadTest failed"); +is(li_std_auto_ptr::overloadTest(new li_std_auto_ptr::Klass("over")), 1, "overloadTest failed"); +checkCount(0); + # auto_ptr as output my $k1 = li_std_auto_ptr::makeKlassAutoPtr("first"); diff --git a/Examples/test-suite/php/cpp11_std_unique_ptr_runme.php b/Examples/test-suite/php/cpp11_std_unique_ptr_runme.php index 77b3f375a..425f6535f 100644 --- a/Examples/test-suite/php/cpp11_std_unique_ptr_runme.php +++ b/Examples/test-suite/php/cpp11_std_unique_ptr_runme.php @@ -83,6 +83,12 @@ takeKlassUniquePtr(NULL); takeKlassUniquePtr(make_null()); checkCount(0); +# overloaded parameters +check::equal(overloadTest(), 0, "overloadTest failed"); +check::equal(overloadTest(NULL), 1, "overloadTest failed"); +check::equal(overloadTest(new Klass("over")), 1, "overloadTest failed"); +checkCount(0); + # unique_ptr as output $k1 = makeKlassUniquePtr("first"); diff --git a/Examples/test-suite/php/li_std_auto_ptr_runme.php b/Examples/test-suite/php/li_std_auto_ptr_runme.php index caf604a3c..7ebcf97b1 100644 --- a/Examples/test-suite/php/li_std_auto_ptr_runme.php +++ b/Examples/test-suite/php/li_std_auto_ptr_runme.php @@ -83,6 +83,12 @@ takeKlassAutoPtr(NULL); takeKlassAutoPtr(make_null()); checkCount(0); +# overloaded parameters +check::equal(overloadTest(), 0, "overloadTest failed"); +check::equal(overloadTest(NULL), 1, "overloadTest failed"); +check::equal(overloadTest(new Klass("over")), 1, "overloadTest failed"); +checkCount(0); + # auto_ptr as output $k1 = makeKlassAutoPtr("first"); diff --git a/Examples/test-suite/python/cpp11_std_unique_ptr_runme.py b/Examples/test-suite/python/cpp11_std_unique_ptr_runme.py index ac3f52c23..9548fc28a 100644 --- a/Examples/test-suite/python/cpp11_std_unique_ptr_runme.py +++ b/Examples/test-suite/python/cpp11_std_unique_ptr_runme.py @@ -81,6 +81,15 @@ takeKlassUniquePtr(None) takeKlassUniquePtr(make_null()) checkCount(0) +# overloaded parameters +if overloadTest() != 0: + raise RuntimeError("overloadTest failed") +if overloadTest(None) != 1: + raise RuntimeError("overloadTest failed") +if overloadTest(Klass("over")) != 1: + raise RuntimeError("overloadTest failed") +checkCount(0); + # unique_ptr as output k1 = makeKlassUniquePtr("first") diff --git a/Examples/test-suite/python/li_std_auto_ptr_runme.py b/Examples/test-suite/python/li_std_auto_ptr_runme.py index c3c5424c6..dd8893f40 100644 --- a/Examples/test-suite/python/li_std_auto_ptr_runme.py +++ b/Examples/test-suite/python/li_std_auto_ptr_runme.py @@ -81,6 +81,15 @@ takeKlassAutoPtr(None) takeKlassAutoPtr(make_null()) checkCount(0) +# overloaded parameters +if overloadTest() != 0: + raise RuntimeError("overloadTest failed") +if overloadTest(None) != 1: + raise RuntimeError("overloadTest failed") +if overloadTest(Klass("over")) != 1: + raise RuntimeError("overloadTest failed") +checkCount(0); + # auto_ptr as output k1 = makeKlassAutoPtr("first") diff --git a/Examples/test-suite/ruby/cpp11_std_unique_ptr_runme.rb b/Examples/test-suite/ruby/cpp11_std_unique_ptr_runme.rb index fd43920b7..59e9691be 100644 --- a/Examples/test-suite/ruby/cpp11_std_unique_ptr_runme.rb +++ b/Examples/test-suite/ruby/cpp11_std_unique_ptr_runme.rb @@ -120,6 +120,18 @@ Cpp11_std_unique_ptr::takeKlassUniquePtr(nil) Cpp11_std_unique_ptr::takeKlassUniquePtr(Cpp11_std_unique_ptr::make_null()) checkCount(0) +# overloaded parameters +if (Cpp11_std_unique_ptr::overloadTest() != 0) + raise RuntimeError, "overloadTest failed" +end +if (Cpp11_std_unique_ptr::overloadTest(nil) != 1) + raise RuntimeError, "overloadTest failed" +end +if (Cpp11_std_unique_ptr::overloadTest(Cpp11_std_unique_ptr::Klass.new("over")) != 1) + raise RuntimeError, "overloadTest failed" +end +checkCount(0); + # unique_ptr as output k1 = Cpp11_std_unique_ptr::makeKlassUniquePtr("first") diff --git a/Examples/test-suite/ruby/li_std_auto_ptr_runme.rb b/Examples/test-suite/ruby/li_std_auto_ptr_runme.rb index a6aa09be2..48276a888 100644 --- a/Examples/test-suite/ruby/li_std_auto_ptr_runme.rb +++ b/Examples/test-suite/ruby/li_std_auto_ptr_runme.rb @@ -120,6 +120,18 @@ Li_std_auto_ptr::takeKlassAutoPtr(nil) Li_std_auto_ptr::takeKlassAutoPtr(Li_std_auto_ptr::make_null()) checkCount(0) +# overloaded parameters +if (Li_std_auto_ptr::overloadTest() != 0) + raise RuntimeError, "overloadTest failed" +end +if (Li_std_auto_ptr::overloadTest(nil) != 1) + raise RuntimeError, "overloadTest failed" +end +if (Li_std_auto_ptr::overloadTest(Li_std_auto_ptr::Klass.new("over")) != 1) + raise RuntimeError, "overloadTest failed" +end +checkCount(0); + # auto_ptr as output k1 = Li_std_auto_ptr::makeKlassAutoPtr("first") diff --git a/Examples/test-suite/schemerunme/cpp11_std_unique_ptr.scm b/Examples/test-suite/schemerunme/cpp11_std_unique_ptr.scm index b181ffcf3..5e6d0dfcc 100644 --- a/Examples/test-suite/schemerunme/cpp11_std_unique_ptr.scm +++ b/Examples/test-suite/schemerunme/cpp11_std_unique_ptr.scm @@ -65,6 +65,15 @@ (takeKlassUniquePtr (make-null)) (checkCount 0) +; overloaded parameters +(unless (= (overloadTest) 0) + (error "overloadTest failed")) +(unless (= (overloadTest nullnil) 1) + (error "overloadTest failed")) +(unless (= (overloadTest (new-Klass "over")) 1) + (error "overloadTest failed")) +(checkCount 0) + ; unique_ptr as output (define k1 (makeKlassUniquePtr "first")) diff --git a/Examples/test-suite/schemerunme/li_std_auto_ptr.scm b/Examples/test-suite/schemerunme/li_std_auto_ptr.scm index cad0c8b80..3ccd83fdb 100644 --- a/Examples/test-suite/schemerunme/li_std_auto_ptr.scm +++ b/Examples/test-suite/schemerunme/li_std_auto_ptr.scm @@ -65,6 +65,15 @@ (takeKlassAutoPtr (make-null)) (checkCount 0) +; overloaded parameters +(unless (= (overloadTest) 0) + (error "overloadTest failed")) +(unless (= (overloadTest nullnil) 1) + (error "overloadTest failed")) +(unless (= (overloadTest (new-Klass "over")) 1) + (error "overloadTest failed")) +(checkCount 0) + ; auto_ptr as output (define k1 (makeKlassAutoPtr "first")) diff --git a/Examples/test-suite/tcl/cpp11_std_unique_ptr_runme.tcl b/Examples/test-suite/tcl/cpp11_std_unique_ptr_runme.tcl index d61ffb78a..9e641df7e 100644 --- a/Examples/test-suite/tcl/cpp11_std_unique_ptr_runme.tcl +++ b/Examples/test-suite/tcl/cpp11_std_unique_ptr_runme.tcl @@ -130,6 +130,18 @@ takeKlassUniquePtr "NULL" takeKlassUniquePtr [make_null] checkCount 0 +# overloaded parameters +if {[overloadTest] != 0} { + error "overloadTest failed" +} +if {[overloadTest "NULL"] != 1} { + error "overloadTest failed" +} +if {[overloadTest [Klass k "over"]] != 1} { + error "overloadTest failed" +} +checkCount 0 + # unique_ptr as output set k1 [makeKlassUniquePtr "first"] diff --git a/Examples/test-suite/tcl/li_std_auto_ptr_runme.tcl b/Examples/test-suite/tcl/li_std_auto_ptr_runme.tcl index d7c019026..502a758dc 100644 --- a/Examples/test-suite/tcl/li_std_auto_ptr_runme.tcl +++ b/Examples/test-suite/tcl/li_std_auto_ptr_runme.tcl @@ -101,6 +101,18 @@ takeKlassAutoPtr "NULL" takeKlassAutoPtr [make_null] checkCount 0 +# overloaded parameters +if {[overloadTest] != 0} { + error "overloadTest failed" +} +if {[overloadTest "NULL"] != 1} { + error "overloadTest failed" +} +if {[overloadTest [Klass k "over"]] != 1} { + error "overloadTest failed" +} +checkCount 0 + # auto_ptr as output set k1 [makeKlassAutoPtr "first"] diff --git a/Lib/csharp/std_auto_ptr.i b/Lib/csharp/std_auto_ptr.i index 78d7eaf4c..da15df3e9 100644 --- a/Lib/csharp/std_auto_ptr.i +++ b/Lib/csharp/std_auto_ptr.i @@ -28,6 +28,8 @@ return ret; } +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > "" + %template() std::auto_ptr< TYPE >; %enddef diff --git a/Lib/csharp/std_unique_ptr.i b/Lib/csharp/std_unique_ptr.i index 2233cdc06..0a4caafbc 100644 --- a/Lib/csharp/std_unique_ptr.i +++ b/Lib/csharp/std_unique_ptr.i @@ -28,6 +28,8 @@ return ret; } +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE > "" + %template() std::unique_ptr< TYPE >; %enddef diff --git a/Lib/d/std_auto_ptr.i b/Lib/d/std_auto_ptr.i index e04a18061..500b6115a 100644 --- a/Lib/d/std_auto_ptr.i +++ b/Lib/d/std_auto_ptr.i @@ -32,6 +32,8 @@ return ret; } +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > "" + %template() std::auto_ptr< TYPE >; %enddef diff --git a/Lib/d/std_unique_ptr.i b/Lib/d/std_unique_ptr.i index 8a06ba066..9317a7e0e 100644 --- a/Lib/d/std_unique_ptr.i +++ b/Lib/d/std_unique_ptr.i @@ -32,6 +32,8 @@ return ret; } +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE > "" + %template() std::unique_ptr< TYPE >; %enddef diff --git a/Lib/guile/std_auto_ptr.i b/Lib/guile/std_auto_ptr.i index 1b1253a16..59d5c0ed8 100644 --- a/Lib/guile/std_auto_ptr.i +++ b/Lib/guile/std_auto_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::auto_ptr< TYPE >; %enddef diff --git a/Lib/guile/std_unique_ptr.i b/Lib/guile/std_unique_ptr.i index 5fc4dc490..6f907e90c 100644 --- a/Lib/guile/std_unique_ptr.i +++ b/Lib/guile/std_unique_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::unique_ptr< TYPE >; %enddef diff --git a/Lib/java/std_auto_ptr.i b/Lib/java/std_auto_ptr.i index 6d65f0451..aee9b4828 100644 --- a/Lib/java/std_auto_ptr.i +++ b/Lib/java/std_auto_ptr.i @@ -31,6 +31,8 @@ return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true); } +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::auto_ptr< TYPE > "" + %template() std::auto_ptr< TYPE >; %enddef diff --git a/Lib/java/std_unique_ptr.i b/Lib/java/std_unique_ptr.i index e1e5a2622..838ca495a 100644 --- a/Lib/java/std_unique_ptr.i +++ b/Lib/java/std_unique_ptr.i @@ -31,6 +31,8 @@ return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true); } +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *") std::unique_ptr< TYPE > "" + %template() std::unique_ptr< TYPE >; %enddef diff --git a/Lib/javascript/jsc/std_auto_ptr.i b/Lib/javascript/jsc/std_auto_ptr.i index d062886e4..3d7ae8ba1 100644 --- a/Lib/javascript/jsc/std_auto_ptr.i +++ b/Lib/javascript/jsc/std_auto_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::auto_ptr< TYPE >; %enddef diff --git a/Lib/javascript/jsc/std_unique_ptr.i b/Lib/javascript/jsc/std_unique_ptr.i index 1a7ec06fa..f988714df 100644 --- a/Lib/javascript/jsc/std_unique_ptr.i +++ b/Lib/javascript/jsc/std_unique_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::unique_ptr< TYPE >; %enddef diff --git a/Lib/javascript/v8/std_auto_ptr.i b/Lib/javascript/v8/std_auto_ptr.i index d062886e4..3d7ae8ba1 100644 --- a/Lib/javascript/v8/std_auto_ptr.i +++ b/Lib/javascript/v8/std_auto_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::auto_ptr< TYPE >; %enddef diff --git a/Lib/javascript/v8/std_unique_ptr.i b/Lib/javascript/v8/std_unique_ptr.i index 1a7ec06fa..f988714df 100644 --- a/Lib/javascript/v8/std_unique_ptr.i +++ b/Lib/javascript/v8/std_unique_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::unique_ptr< TYPE >; %enddef diff --git a/Lib/lua/std_auto_ptr.i b/Lib/lua/std_auto_ptr.i index 3952d6dd6..b3b71d0f2 100644 --- a/Lib/lua/std_auto_ptr.i +++ b/Lib/lua/std_auto_ptr.i @@ -25,6 +25,12 @@ SWIG_NewPointerObj(L, $1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); SWIG_arg++; %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr(L, $input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::auto_ptr< TYPE >; %enddef diff --git a/Lib/lua/std_unique_ptr.i b/Lib/lua/std_unique_ptr.i index 4c1c1fde5..ad08f3b0e 100644 --- a/Lib/lua/std_unique_ptr.i +++ b/Lib/lua/std_unique_ptr.i @@ -25,6 +25,12 @@ SWIG_NewPointerObj(L, $1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); SWIG_arg++; %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr(L, $input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::unique_ptr< TYPE >; %enddef diff --git a/Lib/mzscheme/std_auto_ptr.i b/Lib/mzscheme/std_auto_ptr.i index dd55230b3..c61bc8b26 100644 --- a/Lib/mzscheme/std_auto_ptr.i +++ b/Lib/mzscheme/std_auto_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::auto_ptr< TYPE >; %enddef diff --git a/Lib/mzscheme/std_unique_ptr.i b/Lib/mzscheme/std_unique_ptr.i index af602c342..53cf46694 100644 --- a/Lib/mzscheme/std_unique_ptr.i +++ b/Lib/mzscheme/std_unique_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::unique_ptr< TYPE >; %enddef diff --git a/Lib/octave/std_auto_ptr.i b/Lib/octave/std_auto_ptr.i index d062886e4..3d7ae8ba1 100644 --- a/Lib/octave/std_auto_ptr.i +++ b/Lib/octave/std_auto_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::auto_ptr< TYPE >; %enddef diff --git a/Lib/octave/std_unique_ptr.i b/Lib/octave/std_unique_ptr.i index 1a7ec06fa..f988714df 100644 --- a/Lib/octave/std_unique_ptr.i +++ b/Lib/octave/std_unique_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::unique_ptr< TYPE >; %enddef diff --git a/Lib/perl5/std_auto_ptr.i b/Lib/perl5/std_auto_ptr.i index d062886e4..3d7ae8ba1 100644 --- a/Lib/perl5/std_auto_ptr.i +++ b/Lib/perl5/std_auto_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::auto_ptr< TYPE >; %enddef diff --git a/Lib/perl5/std_unique_ptr.i b/Lib/perl5/std_unique_ptr.i index 1a7ec06fa..f988714df 100644 --- a/Lib/perl5/std_unique_ptr.i +++ b/Lib/perl5/std_unique_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::unique_ptr< TYPE >; %enddef diff --git a/Lib/php/std_auto_ptr.i b/Lib/php/std_auto_ptr.i index bd07dbdb5..284091657 100644 --- a/Lib/php/std_auto_ptr.i +++ b/Lib/php/std_auto_ptr.i @@ -27,6 +27,12 @@ SWIG_SetPointerZval($result, (void *)$1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr(&$input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::auto_ptr< TYPE >; %enddef diff --git a/Lib/php/std_unique_ptr.i b/Lib/php/std_unique_ptr.i index 168273663..1bf31595e 100644 --- a/Lib/php/std_unique_ptr.i +++ b/Lib/php/std_unique_ptr.i @@ -27,6 +27,12 @@ SWIG_SetPointerZval($result, (void *)$1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr(&$input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::unique_ptr< TYPE >; %enddef diff --git a/Lib/python/std_auto_ptr.i b/Lib/python/std_auto_ptr.i index d062886e4..3d7ae8ba1 100644 --- a/Lib/python/std_auto_ptr.i +++ b/Lib/python/std_auto_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::auto_ptr< TYPE >; %enddef diff --git a/Lib/python/std_unique_ptr.i b/Lib/python/std_unique_ptr.i index 1a7ec06fa..f988714df 100644 --- a/Lib/python/std_unique_ptr.i +++ b/Lib/python/std_unique_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::unique_ptr< TYPE >; %enddef diff --git a/Lib/ruby/std_auto_ptr.i b/Lib/ruby/std_auto_ptr.i index d062886e4..3d7ae8ba1 100644 --- a/Lib/ruby/std_auto_ptr.i +++ b/Lib/ruby/std_auto_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::auto_ptr< TYPE >; %enddef diff --git a/Lib/ruby/std_unique_ptr.i b/Lib/ruby/std_unique_ptr.i index 1a7ec06fa..f988714df 100644 --- a/Lib/ruby/std_unique_ptr.i +++ b/Lib/ruby/std_unique_ptr.i @@ -25,6 +25,12 @@ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::unique_ptr< TYPE >; %enddef diff --git a/Lib/tcl/std_auto_ptr.i b/Lib/tcl/std_auto_ptr.i index 3030a1bdf..b24809af7 100644 --- a/Lib/tcl/std_auto_ptr.i +++ b/Lib/tcl/std_auto_ptr.i @@ -25,6 +25,12 @@ Tcl_SetObjResult(interp, SWIG_NewInstanceObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::auto_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::auto_ptr< TYPE >; %enddef diff --git a/Lib/tcl/std_unique_ptr.i b/Lib/tcl/std_unique_ptr.i index 704055676..0ea324cda 100644 --- a/Lib/tcl/std_unique_ptr.i +++ b/Lib/tcl/std_unique_ptr.i @@ -25,6 +25,12 @@ Tcl_SetObjResult(interp, SWIG_NewInstanceObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN)); %} +%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *", noblock=1) std::unique_ptr< TYPE > { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor(TYPE *), 0); + $1 = SWIG_CheckState(res); +} + %template() std::unique_ptr< TYPE >; %enddef |