Modify fix for << in array size

The previous fix broke testcase arrays for Go.
This commit is contained in:
Olly Betts 2022-07-27 12:25:27 +12:00
commit 0ff9a0959a
3 changed files with 11 additions and 4 deletions

View file

@ -6803,7 +6803,11 @@ exprcompound : expr PLUS expr {
$$.type = promote($1.type,$3.type);
}
| expr LSHIFT expr {
$$.val = NewStringf("%s << %s",COMPOUND_EXPR_VAL($1),COMPOUND_EXPR_VAL($3));
/* To avoid confusing SWIG's type system, we replace `<<` with
* `SWIG_LSHIFT` here, then define the latter as a macro in
* the generated wrapper file.
*/
$$.val = NewStringf("%s SWIG_LSHIFT %s",COMPOUND_EXPR_VAL($1),COMPOUND_EXPR_VAL($3));
$$.type = promote_type($1.type);
}
| expr RSHIFT expr {