This is the mail archive of the 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)


Thanks for the answer.
I started thinking that I would recieve nothing.

The main problem is that if you compile several sources, you will not
either an error or a warning but the compiler generates
the different public references for the 'Test'. That means you will get 
error after linking because you will have the public reference
foo(._0 const *) in one file but in another one it will be foo(._1 const
IMHO this is wrong because it is to be handled somehow,
the compiler could issue a warning message at least.

Best regards,
Igor Levko

Mark Mitchell wrote:
> 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. 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 <>
> Consulting Services Available

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