From: Jason Merrill Date: Fri, 27 May 2011 19:31:59 +0000 (-0400) Subject: re PR c++/48284 ([C++0x] incorrect printing of decltype operand in diagnostic) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=87fd3cf18a7e5d67bbbf9a96c34c5476544a4eac;p=gcc.git re PR c++/48284 ([C++0x] incorrect printing of decltype operand in diagnostic) PR c++/48284 * error.c (dump_expr) [COMPONENT_REF]: Use pp_cxx_dot with INDIRECT_REF of REFERENCE_TYPE. From-SVN: r174353 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 332b98cbf93..19ef7caec27 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-05-27 Jason Merrill + PR c++/48284 + * error.c (dump_expr) [COMPONENT_REF]: Use pp_cxx_dot + with INDIRECT_REF of REFERENCE_TYPE. + PR c++/49181 * pt.c (get_mostly_instantiated_function_type): Use push_access_scope. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 8d7aaa71c85..a40630ac9c3 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1890,7 +1890,10 @@ dump_expr (tree t, int flags) && strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this"))) { dump_expr (ob, flags | TFF_EXPR_IN_PARENS); - pp_cxx_arrow (cxx_pp); + if (TREE_CODE (TREE_TYPE (ob)) == REFERENCE_TYPE) + pp_cxx_dot (cxx_pp); + else + pp_cxx_arrow (cxx_pp); } } else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 474b8579456..d034def5f3f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-05-27 Jason Merrill + * g++.dg/cpp0x/error6.C: New. + * g++.dg/cpp0x/error5.C: New. 2011-05-27 Jakub Jelinek diff --git a/gcc/testsuite/g++.dg/cpp0x/error6.C b/gcc/testsuite/g++.dg/cpp0x/error6.C new file mode 100644 index 00000000000..35156520b8e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/error6.C @@ -0,0 +1,8 @@ +// PR c++/48284 +// { dg-options -std=c++0x } + +template +auto g(C& c) -> decltype (c.f()) { return c.f(); } // { dg-error "decltype .c\\.f" } + +template +auto g(C& c) -> decltype (c.f()) { return c.f(); } // { dg-error "decltype .c\\.f" }