From: Jakub Jelinek Date: Tue, 31 Jan 2017 21:38:00 +0000 (+0100) Subject: re PR c++/79304 (diagnostic shows bogus expression ((X*)this)->.c) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=19bdccb4be4b0c3eae14c5634d25e1a83506a2f0;p=gcc.git re PR c++/79304 (diagnostic shows bogus expression ((X*)this)->.c) PR c++/79304 * error.c (dump_expr) : Don't print . after ARROW_EXPR. * g++.dg/diagnostic/pr79304.C: New test. From-SVN: r245073 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 04d2a6017e8..560bbfab3e8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-01-31 Jakub Jelinek + + PR c++/79304 + * error.c (dump_expr) : Don't print . + after ARROW_EXPR. + 2017-01-31 David Malcolm PR c++/79298 diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 4f4c11df570..92137f7c021 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -2247,7 +2247,8 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags) else { dump_expr (pp, ob, flags | TFF_EXPR_IN_PARENS); - pp_cxx_dot (pp); + if (TREE_CODE (ob) != ARROW_EXPR) + pp_cxx_dot (pp); } dump_expr (pp, TREE_OPERAND (t, 1), flags & ~TFF_EXPR_IN_PARENS); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ef50edab562..c313baa6437 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-01-31 Jakub Jelinek + + PR c++/79304 + * g++.dg/diagnostic/pr79304.C: New test. + 2017-01-31 David Malcolm PR c++/79298 diff --git a/gcc/testsuite/g++.dg/diagnostic/pr79304.C b/gcc/testsuite/g++.dg/diagnostic/pr79304.C new file mode 100644 index 00000000000..eedae42cbdf --- /dev/null +++ b/gcc/testsuite/g++.dg/diagnostic/pr79304.C @@ -0,0 +1,20 @@ +// PR c++/79304 +// { dg-do compile } + +struct C { }; + +template +struct X +{ + C* c; + + void f() { + this->c.s(); // { dg-error "->c" } + } +}; + +int main() +{ + X x; + x.f(); +}