This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Foo<int,(char*)&string>
- From: mec dot gnu at mindspring dot com (Michael Elizabeth Chastain)
- To: carlton at kealia dot com, drow at mvista dot com
- Cc: gdb at sources dot redhat dot com
- Date: Mon, 16 Feb 2004 21:20:08 -0500 (EST)
- Subject: Foo<int,(char*)&string>
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