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

           Summary: class DW_AT_name does not match method's linkage name
                    prefix
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: jan.kratoch...@redhat.com
                CC: do...@gcc.gnu.org
            Target: x86_64-unknown-linux-gnu


------------------------------------------------------------------------------
struct S {
  static void m (int x) {}
};
template<void (*T) (int)>
// or: template<void (T) (int)>
struct K {
  void f () { T (0); }
};
int main () {
  K<&S::m> k;
// or: K<S::m> k;
  k.f ();
}
------------------------------------------------------------------------------

    < c>   DW_AT_producer    : GNU C++ 4.7.0 20110627 (experimental)   
 <1><54>: Abbrev Number: 6 (DW_TAG_structure_type)
    <55>   DW_AT_name        : K<S::m> 
 <2><60>: Abbrev Number: 7 (DW_TAG_subprogram)
    <66>   DW_AT_MIPS_linkage_name: _ZN1KIXadL_ZN1S1mEiEEE1fEv

With the demangler fix PR debug/49408 it now demanges to: K<&S::m>::f()
But therefore K<S::m> does not match K<&S::m>.

DWARF is exactly the for all the four combination of alternative lines.

As both K<&S::m>::f() functions have exactly the same mangled name
_ZN1KIXadL_ZN1S1mEiEEE1fEv , the demangled names should match the source form
and in the example below it is the only allowed form of the source the
function should demangled to K<&S::m>::f().

But it also cannot always match the source form when multiple source notations
compile into exactly the same output.

source referenced in the text above:
------------------------------------------------------------------------------
struct S {
  void m (int x) {}
};
template<void (S::*F) (int)>
struct K {
  void f () { S s; (s.*F) (5); }
};
int main () {
  K<&S::m> k;
  k.f ();
}
------------------------------------------------------------------------------

FYI:
_ZN1KIXadL_ZN1S1mEiEEE1fEv
typed name
  qualified name
    template
      name 'K'
      template argument list
        unary operator
          operator &
          typed name
            qualified name
              name 'S'
              name 'm'
            function type
              argument list
                builtin type int
    name 'f'
  function type
    argument list

Reply via email to