mirror of
https://github.com/cc65/cc65.git
synced 2024-11-16 02:10:52 +00:00
Merge pull request #2521 from kugelfuhr/kugelfuhr/fix-2520
Fix wrong evaluation of ternary expressions in the preprocessor
This commit is contained in:
commit
16258d812b
@ -726,7 +726,7 @@ static void PPhieQuest (PPExpr* Expr)
|
||||
PPhieQuest (&Expr3);
|
||||
|
||||
/* Set the result */
|
||||
Expr->IVal = Expr->IVal ? Expr2.IVal != 0 : Expr3.IVal != 0;
|
||||
Expr->IVal = Expr->IVal ? Expr2.IVal : Expr3.IVal;
|
||||
|
||||
/* Restore evaluation as before */
|
||||
PPEvaluationEnabled = PPEvaluationEnabledPrev;
|
||||
|
4
test/val/bug2520.c
Normal file
4
test/val/bug2520.c
Normal file
@ -0,0 +1,4 @@
|
||||
#if (1 ? 2 : 0) != 2
|
||||
#error
|
||||
#endif
|
||||
int main() { return 0; }
|
Loading…
Reference in New Issue
Block a user