First bit of C++ support: Different precedence for ?:.
authorChristoph Mallon <christoph.mallon@gmx.de>
Sun, 26 Oct 2008 19:49:53 +0000 (19:49 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Sun, 26 Oct 2008 19:49:53 +0000 (19:49 +0000)
[r23216]

parser.c

index e8813f3..e749e97 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -7498,7 +7498,8 @@ static expression_t *parse_conditional_expression(expression_t *expression)
                true_expression = parse_expression();
        rem_anchor_token(':');
        expect(':');
-       expression_t *false_expression = parse_sub_expression(PREC_CONDITIONAL);
+       expression_t *false_expression =
+               parse_sub_expression(c_mode & _CXX ? PREC_ASSIGNMENT : PREC_CONDITIONAL);
 
        type_t *const orig_true_type  = true_expression->base.type;
        type_t *const orig_false_type = false_expression->base.type;