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:
parent
0cfccf817f
commit
93f0390322
10 changed files with 75 additions and 5 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue