Support most cases of sizeof applied to an expression
Previously there was only support for `sizeof(<type>)` and expressions which syntactically look like a type (such as `sizeof(foo)`). Fixes #2091.
This commit is contained in:
parent
6f952806e4
commit
7ab24e7e86
3 changed files with 46 additions and 0 deletions
|
|
@ -32,4 +32,25 @@ double d_array[12 % 9];
|
|||
#define TEST_I 0
|
||||
#endif
|
||||
|
||||
/* sizeof didn't work on an expression before SWIG 4.1.0 except for cases where
|
||||
* the expression was in parentheses and looked syntactically like a type (so
|
||||
* sizeof(X) worked because X could be a type syntactically).
|
||||
*/
|
||||
const int s1a = sizeof(X); /* worked before 4.1.0 */
|
||||
//const int s1b = sizeof X; /* not currently supported */
|
||||
const int s2a = sizeof("a string" );
|
||||
const int s2b = sizeof "a string";
|
||||
const int s3a = sizeof('c');
|
||||
const int s3b = sizeof('c');
|
||||
const int s4a = sizeof(L"a wstring");
|
||||
const int s4b = sizeof L"a wstring";
|
||||
const int s5a = sizeof(L'C');
|
||||
const int s5b = sizeof L'C';
|
||||
const int s6a = sizeof(sizeof(X));
|
||||
const int s6b = sizeof sizeof(X);
|
||||
const int s7a = sizeof(3.14);
|
||||
const int s7b = sizeof 3.14;
|
||||
const int s8a = sizeof(2.1e-6);
|
||||
const int s8b = sizeof 2.1e-6;
|
||||
|
||||
%}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue