This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/3870
- To: gcc-gnats at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Subject: Re: c++/3870
- From: Martin Sebor <sebor at roguewave dot com>
- Date: Wed, 19 Sep 2001 11:59:02 -0600
- Organization: Rogue Wave Software, Inc.
While trying to work around this
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3870&database=gcc
I discovered that subsequent declarations compile fine. How bizarre!
Martin
template <class T>
struct A { typedef int I; };
template <class T>
typename T::I
foo (typename T::I, const T*);
template <>
int foo (int i, const A<long>*)
{
return 0; // i + 1; // comment out to prevent error
}
#define foo bar
template <class T>
typename T::I
foo (typename T::I, const T*);
template <>
int foo (int i, const A<long>*)
{
return i + 1; // voila, it now works!
}
int main ()
{
return bar (0, (A<long>*)0);
}