UTL - Fix some incorrect acceptance of types in the STL, eg a double * element passed into a vector<int *> constructor would be accepted, but the ensuing behaviour was undefined. Now the type conversion correctly raises an exception

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10958 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-11-28 23:35:46 +00:00
commit 93f0390322
10 changed files with 75 additions and 5 deletions

View file

@ -133,3 +133,24 @@ if overloaded3(None) != "vector<int> *":
if overloaded3(100) != "int":
raise RuntimeError
# vector pointer checks
ip = makeIntPtr(11)
dp = makeDoublePtr(33.3)
error = 0
try:
vi = IntPtrVector((ip, dp)) # check vector<int *> does not accept double * element
error = 1
except:
pass
if error:
raise RuntimeError
vi = IntPtrVector((ip, makeIntPtr(22)))
if extractInt(vi[0]) != 11:
raise RuntimeError
if extractInt(vi[1]) != 22:
raise RuntimeError

View file

@ -0,0 +1,8 @@
from li_std_vector_ptr import *
ip1 = makeIntPtr(11)
ip2 = makeIntPtr(22)
vi = IntPtrVector((ip1, ip2))
displayVector(vi)