c++/3870

Martin Sebor sebor@roguewave.com
Wed Sep 19 10:52:00 GMT 2001


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);
}



More information about the Gcc-bugs mailing list