Correct precedence for printing ?: in C++ mode.
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 20 Nov 2008 06:27:03 +0000 (06:27 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 20 Nov 2008 06:27:03 +0000 (06:27 +0000)
[r23839]

ast.c

diff --git a/ast.c b/ast.c
index cfec103..4621294 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -647,7 +647,8 @@ static void print_conditional(const conditional_expression_t *expression)
        } else {
                fputs(": ", out);
        }
-       print_expression_prec(expression->false_expression, PREC_CONDITIONAL);
+       precedence_t prec = c_mode & _CXX ? PREC_ASSIGNMENT : PREC_CONDITIONAL;
+       print_expression_prec(expression->false_expression, prec);
 }
 
 /**