This is the mail archive of the gcc-prs@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++/8897: Demangling of template conversion operators


The following reply was made to PR c++/8897; it has been noted by GNATS.

From: Carlo Wood <carlo at alinoe dot com>
To: Benjamin Kosnik <bkoz at redhat dot com>
Cc: gcc-gnats at gcc dot gnu dot org, martin at v dot loewis dot de, gcc-bugs at gcc dot gnu dot org
Subject: Re: c++/8897: Demangling of template conversion operators
Date: Tue, 25 Feb 2003 16:05:45 +0100

 On Mon, Feb 24, 2003 at 11:45:07PM -0600, Benjamin Kosnik wrote:
 > Did you get a chance to look at:
 > 
 > // c++/8897
 > void test05()
 > {
 >   // cplus-dem FAIL  
 >   // icc FAIL
 >   // new __cxa_demangle FAIL
 >   test("_ZN1AIfEcvT_IiEEv", "A<float>::operator float<int>(void)");
 >   // XXX better "A<float>::operator int()"
 >   // XXX better "A<float>::operator T()[T=int]"
 > }
 > 
 > I'm not quite sure what's up with this one.
 
 It's
 
 template<typename T1>
   struct A {
     template<typename T2>
       operator T2();
   };
 
 A<float> a;
 (int)a;		<-- that function.
 
 The demangling is obvious a bug.  A first "fix" would
 be to print:
 
 A<float>::operator int<int>()
 
 compare
 
 A<float>::templatememberfunction<int>()
 
 or say, A<float>::operator +=<double>(double), being
   template<typename T>
     operator+=(T);
 
 But, when the cast type is a class, that could be
 confusing:
 
 A<float>::operator B<B>()
 
 Note 'B' cannot be a template, and thus this is NOT ambigious.
 If B was a template, you'd get:
 
 A<float>::operator B<int><B<int> >()
 
 for example.
 
 But, the question is: how do you WANT it to look?
 
 I don't like to use "operator T() [with T = int]"
 because it would be the only instance that the demangler
 would use that format.  I think I do prefer the
 "operator int<int>()".
 
 -- 
 Carlo Wood <carlo at alinoe dot com>


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