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
This commit is contained in:
Matthias Köppe 2005-06-10 10:31:18 +00:00
commit c0c0689298

View file

@ -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);