Bug 474651 - Cannot combine std::vector begin() with insert()
Cannot combine std::vector begin() with insert()
Product: Fedora
Classification: Fedora
Component: swig (Show other bugs)
All Linux
low Severity high
: ---
: ---
Assigned To: Adam Tkac
Fedora Extras Quality Assurance
: Triaged
Depends On:
  Show dependency treegraph
Reported: 2008-12-04 14:04 EST by Ben Webb
Modified: 2013-04-30 19:42 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-12-18 02:09:41 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Makefile (233 bytes, text/plain)
2008-12-04 14:04 EST, Ben Webb
no flags Details
test.i (76 bytes, text/plain)
2008-12-04 14:04 EST, Ben Webb
no flags Details
swig-iterators.patch (522 bytes, patch)
2008-12-04 14:08 EST, Ben Webb
no flags Details | Diff

  None (edit)
Description Ben Webb 2008-12-04 14:04:10 EST
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):

How reproducible:

Steps to Reproduce:
1. Download the attached test.i and Makefile into the same directory.
2. Install SWIG, python and g++.
3. Type 'make'.
Actual results:
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

Expected results:
The call to insert() succeeds with no output.

Additional info:
Comment 1 Ben Webb 2008-12-04 14:04:40 EST
Created attachment 325721 [details]
Comment 2 Ben Webb 2008-12-04 14:07:05 EST
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.
Comment 3 Ben Webb 2008-12-04 14:08:17 EST
Created attachment 325722 [details]

This proposed fix backs out SWIG SVN r10322 and restores non-const iterators. This fixes the problem for me.
Comment 4 Adam Tkac 2008-12-08 06:18:52 EST
(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.
Comment 5 Ben Webb 2008-12-08 12:32:19 EST
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.
Comment 6 Bug Zapper 2009-11-18 04:38:13 EST
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: 
Comment 7 Bug Zapper 2009-12-18 02:09:41 EST
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.

Note You need to log in before you can comment on or make changes to this bug.