This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/37677] GCC produces mangled names which can't be demangled



------- Comment #1 from meheff at gcc dot gnu dot org  2008-09-30 00:10 -------
(In reply to comment #0)
> The following code produces a bad mangled name (or at least a mangled name that
> c++filt cannot handle):
> 
> template <typename F> class C { public: C(); };
> class D
> {
> public:
>  template <typename F>
>  operator C<F>() { return C<F>(); }
> };
> C<bool> foo(D* p) { return *p; }
> 
> The final line produces the symbol ZN1Dcv1CIT_EIbEEv.  c++filt cannot demangle
> it.
> 
> Below is
> 

Grrr... sent too soon.  Below is a side channel email from iant@google.com
about the problem:

This produces the symbol _ZN1Dcv1CIT_EIbEEv which is not demangled.
Building the demangler code with -DSTANDALONE_DEMANGLER
-DCP_DEMANGLE_DEBUG gives me this:

> ./foo _ZN1Dcv1CIT_EIbEEv
typed name
 template
   qualified name
     name 'D'
     cast
       template
         name 'C'
         template argument list
           template parameter 0
   template argument list
     builtin type bool
 function type
Failed: _ZN1Dcv1CIT_EIbEEv

This works out to something like
   (D::operator C<bool>)<bool>()
It's weird because there seems to be an extra templatization in
there.  The symbol is really
   D::operator C<bool>()
which has one template.  So why does the mangled name have two?

Clearly the "T_" is expected to map to "b".  If I do that mapping
myself (_ZN1Dcv1CIbEIbEEv) it demangles to
   D::operator C<bool><bool>()
which is weird.

I'm inclined to think that the correct mangling for this should be
_ZN1Dcv1CIbEEv, which demangles to simply
   D::operator C<bool>()
I don't understand the extra level of template wrapping.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37677


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]