From 77a84799b7840608d6af73b098bf36cc6bc540f3 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 10 Aug 2007 18:05:07 +0000 Subject: [PATCH] re PR c++/17763 (Wrong context in error message for template parameter) /cp 2007-08-10 Paolo Carlini PR c++/17763 * error.c (dump_expr): Consistently use the *_cxx_* variants of the pretty-print functions. /testsuite 2007-08-10 Paolo Carlini PR c++/17763 * g++.dg/other/error16.C: New. From-SVN: r127346 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/error.c | 4 ++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/other/error16.C | 14 ++++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/other/error16.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9cb6d56e2700..126b3f6a9112 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2007-08-10 Paolo Carlini + + PR c++/17763 + * error.c (dump_expr): Consistently use the *_cxx_* + variants of the pretty-print functions. + 2007-06-20 Dirk Mueller PR c++/31809 diff --git a/gcc/cp/error.c b/gcc/cp/error.c index be4563265d72..e1cdfcd0015e 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1413,13 +1413,13 @@ dump_expr (tree t, int flags) if (TREE_CODE (ob) == ADDR_EXPR) { dump_expr (TREE_OPERAND (ob, 0), flags | TFF_EXPR_IN_PARENS); - pp_dot (cxx_pp); + pp_cxx_dot (cxx_pp); } else if (TREE_CODE (ob) != PARM_DECL || strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this")) { dump_expr (ob, flags | TFF_EXPR_IN_PARENS); - pp_arrow (cxx_pp); + pp_cxx_arrow (cxx_pp); } args = TREE_CHAIN (args); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a292d2f5c545..035e3efe8b8c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-08-10 Paolo Carlini + + PR c++/17763 + * g++.dg/other/error16.C: New. + 2007-08-01 Andreas Krebbel * gcc.dg/20070801-1.c: New testcase. diff --git a/gcc/testsuite/g++.dg/other/error16.C b/gcc/testsuite/g++.dg/other/error16.C new file mode 100644 index 000000000000..1e34647145da --- /dev/null +++ b/gcc/testsuite/g++.dg/other/error16.C @@ -0,0 +1,14 @@ +// PR c++/17763 + +template struct Outer { + struct Inner {}; + Inner foo(); +}; + +typedef int X; +typedef Outer XOuter; + +int main() { + Outer ab; + ab.foo() == 1; // { dg-error "ab.Outer" } +} -- 2.47.2