From faf1b0afc837a76812f9c85e38278a6ca2c275d7 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 1 Dec 2015 16:46:13 -0500 Subject: [PATCH 23/26] FIXME: fix 'this' --- gcc/cp/parser.c | 2 +- .../g++.dg/plugin/diagnostic-test-expressions-1.C | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 24aa454..608cfae 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -4805,7 +4805,7 @@ cp_parser_primary_expression (cp_parser *parser, /* Pointers cannot appear in constant-expressions. */ if (cp_parser_non_integral_constant_expression (parser, NIC_THIS)) return error_mark_node; - return finish_this_expr (); + return cp_expr (finish_this_expr (), token->location); /* The `operator' keyword can be the beginning of an id-expression. */ 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 66e55ad..3d764a1 100644 --- a/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C +++ b/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C @@ -634,3 +634,20 @@ void test_methods () ^~~~ { dg-end-multiline-output "" } */ } + +class tests +{ +public: + void test_method_calls (); + int some_method () const; +}; + +void +tests::test_method_calls () +{ + __emit_expression_range (0, this->some_method () ); /* { dg-warning "range" } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, this->some_method () ); + ~~~~~~~~~~~~~~~~~~^~ + { dg-end-multiline-output "" } */ +} -- 1.8.5.3