mirror of git://gcc.gnu.org/git/gcc.git
c++: Fix demangling of x.operator type
d_operator_name decides whether "cv" indicates a cast or a conversion operator based on is_expression. "on" specifies that we want the conversion operator. libiberty/ChangeLog: * cp-demangle.c (d_unqualified_name): Clear is_expression. * testsuite/demangle-expected: Add tests.
This commit is contained in:
parent
0e1d4b3bfe
commit
7169049332
|
@ -1632,9 +1632,15 @@ d_unqualified_name (struct d_info *di)
|
||||||
ret = d_source_name (di);
|
ret = d_source_name (di);
|
||||||
else if (IS_LOWER (peek))
|
else if (IS_LOWER (peek))
|
||||||
{
|
{
|
||||||
|
int was_expr = di->is_expression;
|
||||||
if (peek == 'o' && d_peek_next_char (di) == 'n')
|
if (peek == 'o' && d_peek_next_char (di) == 'n')
|
||||||
d_advance (di, 2);
|
{
|
||||||
|
d_advance (di, 2);
|
||||||
|
/* Treat cv as naming a conversion operator. */
|
||||||
|
di->is_expression = 0;
|
||||||
|
}
|
||||||
ret = d_operator_name (di);
|
ret = d_operator_name (di);
|
||||||
|
di->is_expression = was_expr;
|
||||||
if (ret != NULL && ret->type == DEMANGLE_COMPONENT_OPERATOR)
|
if (ret != NULL && ret->type == DEMANGLE_COMPONENT_OPERATOR)
|
||||||
{
|
{
|
||||||
di->expansion += sizeof "operator" + ret->u.s_operator.op->len - 2;
|
di->expansion += sizeof "operator" + ret->u.s_operator.op->len - 2;
|
||||||
|
|
|
@ -1476,3 +1476,9 @@ void f<int>(decltype (__alignof__(int)))
|
||||||
|
|
||||||
_Z1fIiEvDTv111__alignof__tlT_EE
|
_Z1fIiEvDTv111__alignof__tlT_EE
|
||||||
void f<int>(decltype (__alignof__(int{})))
|
void f<int>(decltype (__alignof__(int{})))
|
||||||
|
|
||||||
|
_Z1gI1AEv1SIXadsrT_oncviEE
|
||||||
|
void g<A>(S<&A::operator int>)
|
||||||
|
|
||||||
|
_Z1jI1AEDTcldtfp_oncvPT_EES1_
|
||||||
|
decltype (({parm#1}.(operator A*))()) j<A>(A)
|
||||||
|
|
Loading…
Reference in New Issue