aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-02-03 15:42:48 -0500
committerJason Merrill <jason@gcc.gnu.org>2010-02-03 15:42:48 -0500
commitf000c6a763acc0ba0184c5634f2feb3ea883992c (patch)
tree85f758f12214e67f5aac6efe669abcdc7aa570c7 /libiberty
parentabfe01cec91fae69bb05700bf6a53f41a64fd15c (diff)
downloadgcc-f000c6a763acc0ba0184c5634f2feb3ea883992c.zip
gcc-f000c6a763acc0ba0184c5634f2feb3ea883992c.tar.gz
gcc-f000c6a763acc0ba0184c5634f2feb3ea883992c.tar.bz2
re PR c++/4926 (C++ ABI needs clarification on mangling of complex expressions)
PR c++/4926 PR c++/38600 * mangle.c (write_unqualified_id): Split out from write_expression. (write_unqualified_name): Call it. (write_member_name): Likewise. (write_expression): Support TEMPLATE_ID_EXPR. Disambiguate operator names. From-SVN: r156482
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog2
-rw-r--r--libiberty/cp-demangle.c23
-rw-r--r--libiberty/testsuite/demangle-expected5
3 files changed, 26 insertions, 4 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index d4a43ec..20c88d7 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,5 +1,7 @@
2010-02-03 Jason Merrill <jason@redhat.com>
+ * cp-demangle.c (d_expression): Handle dependent operator name.
+
PR c++/12909
* cp-demangle.c (d_number_component, d_vector_type): New.
(cplus_demangle_type, d_print_comp, d_print_mod): Handle vectors.
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 75706b3..b1319cf 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -2722,11 +2722,18 @@ d_expression (struct d_info *di)
return d_make_function_param (di, index);
}
- else if (IS_DIGIT (peek))
+ else if (IS_DIGIT (peek)
+ || (peek == 'o' && d_peek_next_char (di) == 'n'))
{
/* We can get an unqualified name as an expression in the case of
- a dependent member access, i.e. decltype(T().i). */
- struct demangle_component *name = d_unqualified_name (di);
+ a dependent function call, i.e. decltype(f(t)). */
+ struct demangle_component *name;
+
+ if (peek == 'o')
+ /* operator-function-id, i.e. operator+(t). */
+ d_advance (di, 2);
+
+ name = d_unqualified_name (di);
if (name == NULL)
return NULL;
if (d_peek_char (di) == 'I')
@@ -2784,10 +2791,18 @@ d_expression (struct d_info *di)
{
struct demangle_component *left;
struct demangle_component *right;
+ const char *code = op->u.s_operator.op->code;
left = d_expression (di);
- if (!strcmp (op->u.s_operator.op->code, "cl"))
+ if (!strcmp (code, "cl"))
right = d_exprlist (di);
+ else if (!strcmp (code, "dt") || !strcmp (code, "pt"))
+ {
+ right = d_unqualified_name (di);
+ if (d_peek_char (di) == 'I')
+ right = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE,
+ right, d_template_args (di));
+ }
else
right = d_expression (di);
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
index 3662f16..0f85ddc 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -3932,6 +3932,11 @@ f(float vector[32])
--format=gnu-v3
_Z1fIfLi4EEvDv_T0__T_
void f<float, 4>(float vector[4])
+_Z1fI1AEDTclonplfp_fp_EET_
+decltype ((operator+)({parm#1}, {parm#1})) f<A>(A)
+--format=gnu-v3
+_Z1hI1AEDTcldtfp_miEET_
+decltype (({parm#1}.(operator-))()) h<A>(A)
#
# Ada (GNAT) tests.
#