aboutsummaryrefslogtreecommitdiff
path: root/libiberty/cp-demangle.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2023-06-12 19:37:04 -0400
committerNathan Sidwell <nathan@acm.org>2023-06-13 17:07:01 -0400
commit5a897036187468d4ded330b90b2abdaff5061ed6 (patch)
tree9fdcae0a2ea04f97a0bc03c27ace3132fa84657c /libiberty/cp-demangle.c
parenta54c71ccc24874ce79019b51150b3a00b7c785cd (diff)
downloadgcc-5a897036187468d4ded330b90b2abdaff5061ed6.zip
gcc-5a897036187468d4ded330b90b2abdaff5061ed6.tar.gz
gcc-5a897036187468d4ded330b90b2abdaff5061ed6.tar.bz2
c++: Fix templated convertion operator demangling
Instantiations of templated conversion operators failed to demangle for cases such as 'operator X<int>', but worked for 'operator X<int> &', due to thinking the template instantiation of X was the instantiation of the conversion operator itself. libiberty/ * cp-demangle.c (d_print_conversion): Remove incorrect template instantiation handling. * testsuite/demangle-expected: Add testcases.
Diffstat (limited to 'libiberty/cp-demangle.c')
-rw-r--r--libiberty/cp-demangle.c28
1 files changed, 3 insertions, 25 deletions
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 18ab28f..3bd303a 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -6660,32 +6660,10 @@ d_print_conversion (struct d_print_info *dpi, int options,
dpt.template_decl = dpi->current_template;
}
- if (d_left (dc)->type != DEMANGLE_COMPONENT_TEMPLATE)
- {
- d_print_comp (dpi, options, d_left (dc));
- if (dpi->current_template != NULL)
- dpi->templates = dpt.next;
- }
- else
- {
- d_print_comp (dpi, options, d_left (d_left (dc)));
-
- /* For a templated cast operator, we need to remove the template
- parameters from scope after printing the operator name,
- so we need to handle the template printing here. */
- if (dpi->current_template != NULL)
- dpi->templates = dpt.next;
+ d_print_comp (dpi, options, d_left (dc));
- if (d_last_char (dpi) == '<')
- d_append_char (dpi, ' ');
- d_append_char (dpi, '<');
- d_print_comp (dpi, options, d_right (d_left (dc)));
- /* Avoid generating two consecutive '>' characters, to avoid
- the C++ syntactic ambiguity. */
- if (d_last_char (dpi) == '>')
- d_append_char (dpi, ' ');
- d_append_char (dpi, '>');
- }
+ if (dpi->current_template != NULL)
+ dpi->templates = dpt.next;
}
/* Initialize the information structure we use to pass around