diff --git a/Examples/test-suite/preproc_constants.i b/Examples/test-suite/preproc_constants.i index 628cae1dd..3050baa06 100644 --- a/Examples/test-suite/preproc_constants.i +++ b/Examples/test-suite/preproc_constants.i @@ -95,6 +95,11 @@ #define EXPR_CHAR_COMPOUND_LSHIFT 'B' << 6 #define H_SUPPRESS_SCALING_MAGIC (('s'<<24) | ('u'<<16) | ('p'<<8) | 'p') +// https://sourceforge.net/p/swig/bugs/1168/ +#define CHR(ch1,ch2,ch3,ch4) (((ch1)<<24)|((ch2)<<16)|((ch3)<<8)|(ch4)) +#define DEFAULT_LANG CHR('d','f','l','t') +%constant DEFAULT_LANG_SIMPLIFIED = ('d')<<24; + /// constant assignment in enum #if defined(SWIGCSHARP) %csconstvalue("1<<2") kValue; diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 60c92f52f..857cecd0e 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -6316,9 +6316,12 @@ valexpr : exprnum { $$ = $1; } /* grouping */ | LPAREN expr RPAREN %prec CAST { - $$.val = NewStringf("(%s)",$2.val); + $$.val = NewStringf("(%s)",$2.val); + if ($2.rawval) { + $$.rawval = NewStringf("(%s)",$2.rawval); + } $$.type = $2.type; - } + } /* A few common casting operations */