From 7babe38657aa80b2249568b00e8298b04d3c903e Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 1 Dec 2015 16:17:11 -0500 Subject: [PATCH 21/26] FIXME: fix bug in locations of fn calls --- gcc/cp/parser.c | 2 +- gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 042c854..8403a03 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -6708,7 +6708,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, location_t combined_loc = make_location (token->location, start_loc, close_paren_loc); - protected_set_expr_location (postfix_expression, combined_loc); + postfix_expression.set_location (combined_loc); /* The POSTFIX_EXPRESSION is certainly no longer an id. */ idk = CP_ID_KIND_NONE; diff --git a/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C b/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C index 6041794..66e55ad 100644 --- a/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C +++ b/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C @@ -485,6 +485,16 @@ void test_quadratic (double a, double b, double c) } +int bar (int); +void test_combinations (int a) +{ + __emit_expression_range (0, bar (a) > a ); /* { dg-warning "range" } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, bar (a) > a ); + ~~~~~~~~^~~ + { dg-end-multiline-output "" } */ +} + /* C++-specific expresssions. ****************************************/ void test_cp_literal_keywords (int a, int b) -- 1.8.5.3