From 7a1811342e2bf412fa3ad4c023342d4aca47cb54 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Mon, 1 Dec 2014 14:58:01 +0000 Subject: [PATCH] re PR c++/60845 (print original type for typedef classes in diagnostics) /cp 2014-12-01 Paolo Carlini PR c++/60845 * typeck.c (finish_class_member_access_expr): Use %q#T instead of %qD in error message. /testsuite 2014-12-01 Paolo Carlini PR c++/60845 * g++.dg/parse/error55.C: New. From-SVN: r218218 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/typeck.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/parse/error55.C | 7 +++++++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/parse/error55.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6ad557c1b94..c8047612f57 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-12-01 Paolo Carlini + + PR c++/60845 + * typeck.c (finish_class_member_access_expr): Use %q#T instead of + %qD in error message. + 2014-11-29 Jakub Jelinek * cp-gimplify.c (cxx_omp_clause_apply_fn): Remove NULL last argument diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 6ca346b8bd3..ae84b63c145 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2772,7 +2772,7 @@ finish_class_member_access_expr (tree object, tree name, bool template_p, if (member == NULL_TREE) { if (complain & tf_error) - error ("%qD has no member named %qE", + error ("%q#T has no member named %qE", TREE_CODE (access_path) == TREE_BINFO ? TREE_TYPE (access_path) : object_type, name); return error_mark_node; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e56f3d9bc4c..0655cdf0238 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-12-01 Paolo Carlini + + PR c++/60845 + * g++.dg/parse/error55.C: New. + 2014-12-01 Richard Biener PR tree-optimization/15346 diff --git a/gcc/testsuite/g++.dg/parse/error55.C b/gcc/testsuite/g++.dg/parse/error55.C new file mode 100644 index 00000000000..24cca50b2c3 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/error55.C @@ -0,0 +1,7 @@ +// PR c++/60845 + +class A { }; +typedef A B; +void foo (B &a) { + a.x(); // { dg-error "'B {aka class A}' has no member named 'x'" } +} -- 2.30.2