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]

Re: wrong public reference (g++ v2.8.0)



Igor --

  typedef const struct {
  int x;
  } Test, *pTest;

  The problem is that if you try to print name list of the object file
  using '/usr/ccs/bin/nm' you can see that the public name of 'foo' looks
  like 'foo__FPC3._0'
  and 'c++filt' demangls it as foo(._0 const *) that is wrong !!!
  BUT using g++ v.2.7.2.3 the name looks 'foo__FPCC4Test' and after
  demangling 'foo(Test const const *)' that is right.

Actually, I believe that the present behavior is correct.  The
standard says this:

  If the typedef declaration defines an unnamed class (or enum), the
  first typedef-name declared by the declaration to be that class type
  (or enum type) is used to denote the class type (or enum type) for
  linkage purposes only

There is no such typedef-name in this example, since Test names the
const-qualified version of the struct, and since pTest names a pointer
to same.

-- 
Mark Mitchell <mmitchell@usa.net>
http://home.earthlink.net/~mbmitchell
Consulting Services Available


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