Greetings,

I've been redirected here from binutils:
http://sourceware.org/ml/binutils/2013-08/msg00052.html
http://sourceware.org/ml/binutils/2013-08/msg00056.html

The following source:

  template<typename T> static void f();
  void g() { f<int>(); }

results in "_Z1fIiEvv" under g++, but in "_ZL1fIiEvv" under clang.

Richard Smith says:

  The ABI doesn't cover manglings for local symbols ...
  ... and c++filt is not able to cope with the L prefix here.

  I'm having a hard time seeing how this isn't a g++ bug and a matching
  c++filt bug.

It's hard for me to argue that this is a 'g++' bug (since there is no
ABI violation here), but c++filt should be able to handle this, and does
with attached patch.

Ok for trunk?

Thanks,

Google ref: b/10137049
---
Paul Pluzhnikov


2013-08-07  Paul Pluzhnikov  <ppluzhni...@google.com>

        * cp-demangle.c (d_name): Handle internal-linkage templates.
        * testsuite/demangle-expected: New case.


Index: libiberty/testsuite/demangle-expected
===================================================================
--- libiberty/testsuite/demangle-expected       (revision 201577)
+++ libiberty/testsuite/demangle-expected       (working copy)
@@ -4291,3 +4291,6 @@
 --format=gnu-v3
 _Z1nIM1AKFvvREEvT_
 void n<void (A::*)() const &>(void (A::*)() const &)
+--format=gnu-v3
+_ZL1fIiEvv
+void f<int>()
Index: libiberty/cp-demangle.c
===================================================================
--- libiberty/cp-demangle.c     (revision 201577)
+++ libiberty/cp-demangle.c     (working copy)
@@ -1276,7 +1276,6 @@
     case 'Z':
       return d_local_name (di);
 
-    case 'L':
     case 'U':
       return d_unqualified_name (di);
 
@@ -1323,6 +1322,7 @@
        return dc;
       }
 
+    case 'L':
     default:
       dc = d_unqualified_name (di);
       if (d_peek_char (di) == 'I')

Reply via email to