https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115245

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-05-27
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I can't find the concept mangling in the Itanium mangling docs specified at
all.
The comments in cp/mangle.cc and cp-demangle.cc suggest it is
Q <constraint-expression>
where
constraint-expression: expression
r14-6064-gc3f281a0c1ca5 commit that started the corresponding ICE refers
to https://github.com/itanium-cxx-abi/cxx-abi/pull/166 but that doesn't seem to
define Q either.

Anyway, seems the d_expression in
static struct demangle_component *
d_maybe_constraints (struct d_info *di, struct demangle_component *dc)
{
  if (d_peek_char (di) == 'Q')
    {
      d_advance (di, 1);
      struct demangle_component *expr = d_expression (di);
fails (returns NULL).
After Q there is 3cstITL0__...
llvm-cxxfilt demangles this as
void Outer<void>::method<void>() requires cst<TL0_>::Inner::operator
new(unsigned long)
but that can't be right either, there is nothing called TL0_ in the source.
d_expression_1 parses the 3cst part and because of I following it calls
3542          if (d_peek_char (di) == 'I')
3543            return d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, name,
3544                                d_template_args (di));

The TL0__ part comes during mangling from write_template_param on
TEMPLATE_TYPE_PARM U
with level 2 and parm_index 1 (as it writes level - 1 that is the 0_ in there
and _
for parm_index).
Now, this 'L' part has been added there with r14-4544 of PR109422.
So, my guess is the bug is that r14-4544 didn't include corresponding changes
to the demangler,
/* <template-param> ::= T_
                    ::= T <(parameter-2 non-negative) number> _
*/

static struct demangle_component *
d_template_param (struct d_info *di)
{
  int param;

  if (! d_check_char (di, 'T'))
    return NULL;

  param = d_compact_number (di);
  if (param < 0)
    return NULL;

  return d_make_template_param (di, param);
}
can't handle the L with d_compact_number in there.

Reply via email to