Fix handling of array whose size contains <<
Fixes https://sourceforge.net/p/swig/bugs/983/
This commit is contained in:
parent
24ec116742
commit
2227dc9e53
4 changed files with 12 additions and 2 deletions
|
|
@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.1.0 (in progress)
|
||||
===========================
|
||||
|
||||
2022-07-27: olly
|
||||
https://sourceforge.net/p/swig/bugs/983/
|
||||
Fix handling of array whose size contains a left shift operator (<<).
|
||||
|
||||
2022-07-27: ZackerySpytz, olly
|
||||
#1678 Support parsing C++20 templated lambdas.
|
||||
|
||||
|
|
|
|||
|
|
@ -73,4 +73,8 @@ typedef struct {
|
|||
cartPosition_t p;
|
||||
} CartPoseData_t;
|
||||
|
||||
/* Test left shift in array size doesn't trigger "Bad template type" error.
|
||||
* Regression test for https://sourceforge.net/p/swig/bugs/983/ */
|
||||
int array_shifted_size[(1<<2)];
|
||||
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ require "tests.php";
|
|||
|
||||
check::functions(array('fn_taking_arrays','newintpointer','setintfrompointer','getintfrompointer','array_pointer_func'));
|
||||
check::classes(array('arrays','SimpleStruct','ArrayStruct','CartPoseData_t'));
|
||||
check::globals(array());
|
||||
check::globals(array('array_shifted_size'));
|
||||
|
||||
$ss=new simplestruct();
|
||||
check::classname('simplestruct',$ss);
|
||||
|
|
|
|||
|
|
@ -1702,7 +1702,9 @@ void SwigType_remember_clientdata(const SwigType *t, const_String_or_char_ptr cl
|
|||
|
||||
if (t) {
|
||||
char *ct = Char(t);
|
||||
if (strchr(ct, '<') && !(strstr(ct, "<("))) {
|
||||
const char *lt = strchr(ct, '<');
|
||||
/* Allow for `<<` operator in constant expression for array size. */
|
||||
if (lt && lt[1] != '(' && lt[1] != '<') {
|
||||
Printf(stdout, "Bad template type passed to SwigType_remember: %s\n", t);
|
||||
assert(0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue