This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: c++/3870


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]