Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Foo<int,(char*)&string>
@ 2004-02-17  2:20 Michael Elizabeth Chastain
  2004-02-17  2:44 ` Foo<int,(char*)&string> Daniel Jacobowitz
  2004-02-18  0:20 ` Foo<int,(char*)&string> David Carlton
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Elizabeth Chastain @ 2004-02-17  2:20 UTC (permalink / raw)
  To: carlton, drow; +Cc: gdb

Here's a test program, derived from gdb.cp/templates.cc:

  #include <iostream>
  #include <string.h>

  template <class T, char * name>
  class Foo
  {
    public:
      int method ();
  };

  template <class T, char * name> int Foo<T, name>::method ()
  {
    return strlen (name);
  }

  char string [10] = "hello";

  int main ()
  {
    Foo <int, string> f1;
    std::cout << f1.method () << std::endl;
    return 0;
  }

The second template parameter is a "char *"; a value, not a type.

gcc 3.3.2 -gstabs+ emits this:

  .stabs "Foo<int,&string>:Tt(1,1)=..."

gcc HEAD -gstabs+ just changed to emit this:

  .stabs "Foo<int,(char*)(&string)>:Tt(0,25)=..."

Do we care?  I think the "(char*)(&string)" looks ugly but is legal.
I want to change templates.exp to accept this as a PASS.  I've found
enough serious stabs+ bugs with gcc that I don't want to make a fuss
over this difference.

What do you think?

Michael C


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Foo<int,(char*)&string>
  2004-02-17  2:20 Foo<int,(char*)&string> Michael Elizabeth Chastain
@ 2004-02-17  2:44 ` Daniel Jacobowitz
  2004-02-18  0:20 ` Foo<int,(char*)&string> David Carlton
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2004-02-17  2:44 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: carlton, gdb

On Mon, Feb 16, 2004 at 09:20:08PM -0500, Michael Chastain wrote:
> The second template parameter is a "char *"; a value, not a type.
> 
> gcc 3.3.2 -gstabs+ emits this:
> 
>   .stabs "Foo<int,&string>:Tt(1,1)=..."
> 
> gcc HEAD -gstabs+ just changed to emit this:
> 
>   .stabs "Foo<int,(char*)(&string)>:Tt(0,25)=..."
> 
> Do we care?  I think the "(char*)(&string)" looks ugly but is legal.
> I want to change templates.exp to accept this as a PASS.  I've found
> enough serious stabs+ bugs with gcc that I don't want to make a fuss
> over this difference.
> 
> What do you think?

I don't care.  Eventually hopefully we will canonicalize this.  Code to
do it is on drow-cplus-branch (but not used, even there; it can't be
until some other startup performance issues are resolved...).

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Foo<int,(char*)&string>
  2004-02-17  2:20 Foo<int,(char*)&string> Michael Elizabeth Chastain
  2004-02-17  2:44 ` Foo<int,(char*)&string> Daniel Jacobowitz
@ 2004-02-18  0:20 ` David Carlton
  1 sibling, 0 replies; 3+ messages in thread
From: David Carlton @ 2004-02-18  0:20 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: drow, gdb

On Mon, 16 Feb 2004 21:20:08 -0500 (EST), mec.gnu@mindspring.com (Michael Elizabeth Chastain) said:

> The second template parameter is a "char *"; a value, not a type.

> gcc 3.3.2 -gstabs+ emits this:

>   .stabs "Foo<int,&string>:Tt(1,1)=..."

> gcc HEAD -gstabs+ just changed to emit this:

>   .stabs "Foo<int,(char*)(&string)>:Tt(0,25)=..."

> Do we care?  I think the "(char*)(&string)" looks ugly but is legal.
> I want to change templates.exp to accept this as a PASS.

Sounds good to me.

David Carlton
carlton@kealia.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-02-18  0:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-17  2:20 Foo<int,(char*)&string> Michael Elizabeth Chastain
2004-02-17  2:44 ` Foo<int,(char*)&string> Daniel Jacobowitz
2004-02-18  0:20 ` Foo<int,(char*)&string> David Carlton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox