diff options
author | Matthias Köppe <mkoeppe@mail.math.uni-magdeburg.de> | 2005-06-10 10:31:18 +0000 |
---|---|---|
committer | Matthias Köppe <mkoeppe@mail.math.uni-magdeburg.de> | 2005-06-10 10:31:18 +0000 |
commit | c0c068929887e64a380064e96c8b19c0cbedaea3 (patch) | |
tree | b364928b617ffa631cb2aea377ab7a2519edb97e /Lib/guile | |
parent | 5b766d6fc0801c3f8913c024738c348fc14d2615 (diff) | |
download | swig-c0c068929887e64a380064e96c8b19c0cbedaea3.tar.gz |
Fix typecheck for SWIGTYPE.
This fixes the following bug:
Luigi Ballabio wrote:
> The following interface produces Guile wrappers which
> do not compile:
>
> %module Foo
> class Foo {};
> class Bar : public Foo {};
> void baz(Foo f);
>
> The reason seems to be the function baz() taking a Foo by value, which
> causes functions to be emitted in the CONVERSIONS section such as:
>
> static void *_BarTo_Foo(void *x) {
> return (void *)((Foo) ((Bar) x));
> }
> static void *_p_BarTo_p_Foo(void *x) {
> return (void *)((Foo *) ((Bar *) x));
> }
>
> of which the former doesn't compile; on the other hand, only the second
> function is emitted if baz() takes a Foo by const reference.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7266 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Lib/guile')
-rw-r--r-- | Lib/guile/typemaps.i | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/guile/typemaps.i b/Lib/guile/typemaps.i index cbbaf5100..d6349bdca 100644 --- a/Lib/guile/typemaps.i +++ b/Lib/guile/typemaps.i @@ -330,11 +330,16 @@ typedef unsigned long SCM; $1 = SCM_STRINGP($input) ? 1 : 0; } -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE { +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { void *ptr; $1 = !SWIG_ConvertPtr($input, &ptr, $1_descriptor, 0); } +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE { + void *ptr; + $1 = !SWIG_ConvertPtr($input, &ptr, $&descriptor, 0); +} + %typecheck(SWIG_TYPECHECK_VOIDPTR) void * { void *ptr; $1 = !SWIG_ConvertPtr($input, &ptr, 0, 0); |