aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2022-04-14 17:35:35 -0400
committerJason Merrill <jason@redhat.com>2022-04-14 21:00:14 -0400
commit6364a39907bd68624a30df0c8e380c40d2a646c4 (patch)
treef5f0a476d366921513264d5c4388f9f1c0ccf1e8 /gcc/cp
parent031bd52e482a53314d3dfac2d375c1033a6b7031 (diff)
downloadgcc-6364a39907bd68624a30df0c8e380c40d2a646c4.zip
gcc-6364a39907bd68624a30df0c8e380c40d2a646c4.tar.gz
gcc-6364a39907bd68624a30df0c8e380c40d2a646c4.tar.bz2
c++: using in diagnostics [PR102987]
The expression pretty-printing code crashed on a location wrapper with no type, and didn't know what to do with a USING_DECL. PR c++/102987 gcc/cp/ChangeLog: * error.cc (dump_expr): Handle USING_DECL. [VIEW_CONVERT_EXPR]: Just look through location wrapper. gcc/testsuite/ChangeLog: * g++.dg/diagnostic/using1.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/error.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc
index e76842e..1e944ca 100644
--- a/gcc/cp/error.cc
+++ b/gcc/cp/error.cc
@@ -2203,6 +2203,7 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags)
case WILDCARD_DECL:
case OVERLOAD:
case TYPE_DECL:
+ case USING_DECL:
case IDENTIFIER_NODE:
dump_decl (pp, t, ((flags & ~(TFF_DECL_SPECIFIERS|TFF_RETURN_TYPE
|TFF_TEMPLATE_HEADER))
@@ -2584,6 +2585,13 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags)
case VIEW_CONVERT_EXPR:
{
tree op = TREE_OPERAND (t, 0);
+
+ if (location_wrapper_p (t))
+ {
+ dump_expr (pp, op, flags);
+ break;
+ }
+
tree ttype = TREE_TYPE (t);
tree optype = TREE_TYPE (op);