Fix #2746858 - C macro expression using floating point numbers

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11185 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2009-04-09 17:51:59 +00:00
commit bd46f03b6f
3 changed files with 20 additions and 1 deletions

View file

@ -5492,7 +5492,18 @@ valexpr : exprnum { $$ = $1; }
| LPAREN expr RPAREN expr %prec CAST {
$$ = $4;
if ($4.type != T_STRING) {
$$.val = NewStringf("(%s) %s", SwigType_str($2.val,0), $4.val);
switch ($2.type) {
case T_FLOAT:
case T_DOUBLE:
case T_LONGDOUBLE:
case T_FLTCPLX:
case T_DBLCPLX:
$$.val = NewStringf("(%s)%s", $2.val, $4.val); /* SwigType_str and decimal points don't mix! */
break;
default:
$$.val = NewStringf("(%s) %s", SwigType_str($2.val,0), $4.val);
break;
}
}
}
| LPAREN expr pointer RPAREN expr %prec CAST {