From 6904f4b401d50c17b1a0dbd6eac64212700973fa Mon Sep 17 00:00:00 2001 From: David Krauss Date: Fri, 10 Jun 2011 05:18:36 +0000 Subject: re PR c++/49118 (Endless operator-> chain causes infinite loop) PR c++/49118 * typeck2.c (build_x_arrow): Push fake template context to produce diagnostic on acyclic endless operator-> drill-down. * call.c (build_new_op): Change Boolean overload status value to a pointer to the overload function. * cp-tree.h: Likewise. * typeck.c: Likewise. * parser.c: Likewise. * decl2.c: Likewise. * pt.c: Likewise. From-SVN: r174889 --- gcc/cp/parser.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'gcc/cp/parser.c') diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 35f8957..961f9fe 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -6585,7 +6585,7 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p, cp_token *token; enum tree_code tree_type, lhs_type, rhs_type; enum cp_parser_prec new_prec, lookahead_prec; - bool overloaded_p; + tree overload; /* Parse the first expression. */ lhs = cp_parser_cast_expression (parser, /*address_p=*/false, cast_p, pidk); @@ -6688,7 +6688,7 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p, else if (tree_type == TRUTH_ORIF_EXPR) c_inhibit_evaluation_warnings -= lhs == truthvalue_true_node; - overloaded_p = false; + overload = NULL; /* ??? Currently we pass lhs_type == ERROR_MARK and rhs_type == ERROR_MARK for everything that is not a binary expression. This makes warn_about_parentheses miss some warnings that @@ -6703,7 +6703,7 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p, lhs = build2 (tree_type, boolean_type_node, lhs, rhs); else lhs = build_x_binary_op (tree_type, lhs, lhs_type, rhs, rhs_type, - &overloaded_p, tf_warning_or_error); + &overload, tf_warning_or_error); lhs_type = tree_type; /* If the binary operator required the use of an overloaded operator, @@ -6712,7 +6712,7 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p, otherwise permissible in an integral constant-expression if at least one of the operands is of enumeration type. */ - if (overloaded_p + if (overload && cp_parser_non_integral_constant_expression (parser, NIC_OVERLOADED)) return error_mark_node; @@ -24245,8 +24245,6 @@ cp_parser_omp_for_cond (cp_parser *parser, tree decl) { tree cond = cp_parser_binary_expression (parser, false, true, PREC_NOT_OPERATOR, NULL); - bool overloaded_p; - if (cond == error_mark_node || cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON)) { @@ -24275,7 +24273,7 @@ cp_parser_omp_for_cond (cp_parser *parser, tree decl) return build_x_binary_op (TREE_CODE (cond), TREE_OPERAND (cond, 0), ERROR_MARK, TREE_OPERAND (cond, 1), ERROR_MARK, - &overloaded_p, tf_warning_or_error); + /*overload=*/NULL, tf_warning_or_error); } /* Helper function, to parse omp for increment expression. */ -- cgit v1.1