Hi,

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

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 ();
}

 <1><64>: Abbrev Number: 8 (DW_TAG_structure_type)
    <65>   DW_AT_name        : K<&S::m>        
                                 ^^^^^
vs.
00000000004004de W K<&(S::m(int))>::f()
                     ^^^^^^^^^^^^

The function linkage name has prefix: K<&(S::m(int))>
But DW_AT_name of that struct is:     K<&S::m>
They do not match.

But the struct DW_AT_name corresponds to the source literal 'K<&S::m>'.
So maybe the function linkage name should be changed to: 'K<&S::m>::f()'.
But changing the function linkage name would break ABI.

OTOH the function linkage name should probably refer to the fully qualified
'S::m' overload - to be able to look up 'S::m(int)' from the linkage name:

_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         --- important to find 'S::m(int)'
              argument list       --- important to find 'S::m(int)'
                builtin type int  --- important to find 'S::m(int)'
    name 'f'
  function type
    argument list


Or maybe it is not a bug and one just has to accept the function prefix may
not match its struct/class name?

Deciding how to deal with the GDB testcase:
        gdb.cp/temargs.exp: test type of F in k2_m


Thanks for advice,
Jan

Reply via email to