This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: [c++] Another question about demangler output


On Sun, Dec 07, 2003 at 05:24:46AM +0100, Gabriel Dos Reis wrote:
> Ian Lance Taylor <ian@wasabisystems.com> writes:
> 
> | Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
> | 
> | > Ian Lance Taylor <ian@wasabisystems.com> writes:
> | > 
> | > [...]
> | > 
> | > | This gives _ZN2BBcvPFivEEv which (currently) demangles as
> | > |     BB::operator int (*)()()
> | > | 
> | > | But using a gcc extension, I can do this without a typedef:
> | > | 
> | > | class BB { operator typeof (int(*)())(); };
> | > | BB::operator typeof (int(*)())() { return 0; }
> | > 
> | > If you do that, then you might end up accpeting two different
> | > declarations as same where the token-oriented scheme (ODR) would have
> | > kept them separate.  That is, you would not be able to differentiate
> | > 
> | > tu1.C:
> | > 
> | >   struct B { operator typeof(int(*)())(); };
> | > 
> | > from
> | > 
> | > tu2.C:
> | > 
> | >   struct B { typedef int (*foo)(); operator foo(); };
> | > 
> | > ODR says they are different.
> | 
> | I don't know who the ``you'' is in ``if you do that.''  Or else I
> | don't know what the ``that'' is.
> | 
> | I gave two code samples, and g++ uses the same name mangling for both.
> | Try it.  Is that a bug in g++?
> | 
> | Frankly, I don't see how g++ could do anything else.
> 
> The point is this.  "typeof" is a GNU/C++ extension.  Its use in a
> function declaration should be mangled differently from any standard
> C++ construction.  After all, the ABI has provided hook for vendor
> extension. 

I can't see why in this case.  It's still a conversion operator to "int
(*) ()", right?  The ABI defines the mangled name of this operator.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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