Support foo.bar in constant expressions
This commit is contained in:
parent
98e1251772
commit
e03ef3ecb6
3 changed files with 11 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)
|
Version 4.1.0 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2022-01-25: olly
|
||||||
|
Constant expressions now support member access with `.` such as
|
||||||
|
`foo.bar`. Previous this only worked in a case like `x->foo.bar`.
|
||||||
|
|
||||||
2022-01-25: olly
|
2022-01-25: olly
|
||||||
#2091 Support most cases of `sizeof` applied to an expression
|
#2091 Support most cases of `sizeof` applied to an expression
|
||||||
in constant expressions. Previously there was only support for
|
in constant expressions. Previously there was only support for
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,11 @@ isPointer = false
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Test handling of ID PERIOD ID in constant expressions (supported since 4.1.0).
|
||||||
|
struct A {
|
||||||
|
int i;
|
||||||
|
};
|
||||||
|
constexpr A a{42};
|
||||||
|
const int N = a.i;
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
|
|
@ -6521,12 +6521,10 @@ exprmem : ID ARROW ID {
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
Printf($$.val, "->%s", $3);
|
Printf($$.val, "->%s", $3);
|
||||||
}
|
}
|
||||||
/* This generates a shift-reduce
|
|
||||||
| ID PERIOD ID {
|
| ID PERIOD ID {
|
||||||
$$.val = NewStringf("%s.%s", $1, $3);
|
$$.val = NewStringf("%s.%s", $1, $3);
|
||||||
$$.type = 0;
|
$$.type = 0;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
| exprmem PERIOD ID {
|
| exprmem PERIOD ID {
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
Printf($$.val, ".%s", $3);
|
Printf($$.val, ".%s", $3);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue