[ swig-Bugs-2380788 ] Bug in SWIG 1.3.35 with std::vector type system?
SourceForge.net <noreply <at> sourceforge.net>
2011-05-08 08:06:07 GMT
Bugs item #2380788, was opened at 2008-12-02 18:01
Message generated for change (Comment added) made by szager
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2380788&group_id=1645
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: code generation (general)
Group: None
>Status: Closed
>Resolution: Duplicate
Priority: 5
Private: No
Submitted By: Ben Webb (benwebb)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bug in SWIG 1.3.35 with std::vector type system?
Initial Comment:
I have encountered a problem with SWIG 1.3.35 and later with a fairly simple usage of std::vector. What
seems to be happening is that the SWIG runtime is getting confused about the type of the std::vector.
For example, running 'make' with the attached Makefile and test.i works (produces no output from Python)
with SWIG 1.3.34, but fails on SWIG 1.3.35, 1.3.36 and SVN r10960 with the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "test.py", line 130, in insert
def insert(self, *args): return _test.vectorf_insert(self, *args)
NotImplementedError: Wrong number of arguments for overloaded function 'vectorf_insert'.
Possible C/C++ prototypes are:
insert(std::vector< float > *,std::vector< float >::iterator,std::vector< float >::value_type
const &)
insert(std::vector< float > *,std::vector< float >::iterator,std::vector< float
>::size_type,std::vector< float >::value_type const &)
Obviously this makes STL vectors rather hard for us to use in practice!
I ran into the problem with Fedora 10's package of SWIG 1.3.35 (Fedora 9's build of 1.3.33 works just fine)
but confirmed that it also fails for me with 1.3.35 built from your upstream sources. (But ideally a
backport of any fix to 1.3.35 would be useful, so that Fedora can patch their package without having to
upgrade to an SVN snapshot.)
----------------------------------------------------------------------
>Comment By: szager (szager)
Date: 2011-05-08 01:06
Message:
Duplicate of bug 2811549, now fixed.
----------------------------------------------------------------------
Comment By: William Fulton (wsfulton)
Date: 2011-02-17 15:06
Message:
Possibly related to #2811549
----------------------------------------------------------------------
Comment By: Ben Webb (benwebb)
Date: 2008-12-04 19:49
Message:
I can certainly help test such a solution, although my experience with the
SWIG internals is minimal. If you can remember anything further about the
Ruby iterator fix, that would be helpful.
----------------------------------------------------------------------
Comment By: William Fulton (wsfulton)
Date: 2008-12-04 14:28
Message:
The warnings are indicative of other problems. How about fixing the
iterators instead? I have a vague recollection that Ruby has the iterators
fixed, so perhaps the Ruby solution can be ported to Python.
----------------------------------------------------------------------
Comment By: Ben Webb (benwebb)
Date: 2008-12-04 10:49
Message:
Thanks - that's just it. Backing out SVN r10322 fixes the problem for me
both with current SVN and 1.3.35. I agree that if you can only have one
version of begin() and friends, it should probably be the non-const version
(I tried backing out the patch and then removing just the const iterators,
and that also works for me). Otherwise, it seems to me that backing out the
patch is the best solution - surely a few warnings are better than code
that fails to run?
----------------------------------------------------------------------
Comment By: Haoyu Bai (bhy)
Date: 2008-12-03 13:26
Message:
This is due to SF patch #1925702 (SVN r10322) "Remove warning 512 when
using std_vector.i":
std_container.i used to provide an interface for both the const and
non-const versions of begin(), end(), rbegin(), and rend(). This causes a
bunch of warning 512's when using std_vector.i. This patch removes the
non-const versions of those four functions, which gets rid of the
warnings.
This patch removed non-const version of begin(), so in SWIG 1.3.35 we got
a const_iterator returned, while std::vector::insert expect a non-const
iterator:
void insert( iterator loc, input_iterator start, input_iterator end );
So seems we should keep the non-const version of begin() etc., and remove
(or rename?) the const version.
----------------------------------------------------------------------
Comment By: Ben Webb (benwebb)
Date: 2008-12-02 18:02
Message:
File Added: test.i
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2380788&group_id=1645
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd