Red Hat Bugzilla – Bug 474651
Cannot combine std::vector begin() with insert()
Last modified: 2013-04-30 19:42:05 EDT
Created attachment 325720 [details]
Description of problem:
In SWIG 1.3.35 any code that requires non-const STL container iterators, which worked with SWIG 1.3.33 in Fedora 9, fails, since non-const iterators are no longer provided. For example, std::vector's insert() can no longer be fed the output of the begin() method, since insert requires a non-const iterator and begin() now can only return a const one.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Download the attached test.i and Makefile into the same directory.
2. Install SWIG, python and g++.
3. Type 'make'.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "test.py", line 117, in insert
def insert(*args): return _test.vectorf_insert(*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 &)
make: *** [test] Error 1
The call to insert() succeeds with no output.
Created attachment 325721 [details]
As I was also able to reproduce this problem with upstream sources, I have also reported it there:
It appears that SWIG 1.3.35 removed non-const iterators in order to quell some compiler warnings. However, since this results in code that will not run, it seems to me that the original warnings were better. I will attach a short patch that fixes this problem for me.
Created attachment 325722 [details]
This proposed fix backs out SWIG SVN r10322 and restores non-const iterators. This fixes the problem for me.
(In reply to comment #3)
> This proposed fix backs out SWIG SVN r10322 and restores non-const iterators.
> This fixes the problem for me.
I can build temporary rpm for you with your patch if you are interested but I'm not going to release update till upstream fix this problem.
That's OK - I can build my own RPM to work around the problem. I'll take it up with upstream. They want to fix the problem "properly" which is of course commendable but makes the public stable releases useless for us in the meantime.
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora
'version' of '10'.
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version prior to Fedora 10's end of life.
Bug Reporter: Thank you for reporting this issue and we are sorry that
we may not be able to fix it before Fedora 10 is end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora please change the 'version' of this
bug to the applicable version. If you are unable to change the version,
please add a comment here and someone will do it for you.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
The process we are following is described here:
Fedora 10 changed to end-of-life (EOL) status on 2009-12-17. Fedora 10 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version.
Thank you for reporting this bug and we are sorry it could not be fixed.