This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/9460: parse error on template member function
- From: "Farfetch'd" <farfetchd at libero dot it>
- To: <gcc-gnats at gcc dot gnu dot org>,<gcc-bugs at gcc dot gnu dot org>,<oliver dot schoenborn at utoronto dot ca>,<nobody at gcc dot gnu dot org>,<gcc-prs at gcc dot gnu dot org>
- Date: Tue, 28 Jan 2003 03:34:27 +0100
- Subject: Re: c++/9460: parse error on template member function
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
r=9460
I am not absolutely sure there is no bug here. For example, look at the
following snippet:
------------
struct Foo
{
template <typename T>
void F1(void) {}
};
template <typename A>
struct Bar
{
void F2(void)
{
Foo f;
f.F1<int>();
}
template <typename T>
void F1(void) {}
};
template Bar<int>;
------------
The previous snippet is accepted by G++ but it shouldn't since it's not
legal. The compiler is fooled by Bar::F1<> having the same name of
Foo::F1<>. Also the following code is accepted as well and should not:
------------
struct Foo
{
template <typename T>
void F1(void) {}
};
template <typename A>
struct Bar
{
void F2(void)
{
Foo().F1<int>();
}
};
template Bar<int>;
------------
since it's still missing the template keyword in the member template call.
So it's not a case of reject-legal, but of accept-illegal.
Giovanni Bajo