[cxx-abi-dev] Handling of cast operators in the mangling ABI

Carlo Wood carlo at alinoe.com
Mon Nov 24 17:45:42 UTC 2003


On Sun, Nov 23, 2003 at 11:17:30PM -0800, Mark Mitchell wrote:
> I don't think there's anything special about a conversion operator.
> 
> If you had another member template function with a return value that was
> a template parameter to the function, you would see the same behavior.
> 
> If you want to prepare a patch to the HTML document (using the
> non-normative note formatting that is used elsewhere), we can see if
> people want to apply it.  (I would certainly be in favor.)

Well, he is certainly right that from a demangler point
of view it is a special case.  My demangler was broken
for this too and I had to fix it later by adding special
code for this case.  A clarification might therefore by
in order.

  else if (opcode0 == 'c' && opcode1 == 'v')  // casting operator
  {
    eat_current();
    output += "operator ";
    if (current() == 'T')
    {
      // This is a templated cast operator.
      // It must be of the form "cvT_I...E".
      // Let M_template_arg_pos already point
      // to the template argument.
      M_template_arg_pos_offset = M_template_arg_pos.size();
      M_template_arg_pos.push_back(M_pos + 3);
    }
    if (!decode_type(output))
      _GLIBCXX_DEMANGLER_FAILURE


The part of the 'if (current() == 'T') { }' is the code that
handles this 'exception'.

-- 
Carlo Wood <carlo at alinoe.com>



More information about the cxx-abi-dev mailing list