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]

Bug?


I am not sure if this bug is in egcs or in my code, but the following code 
compiled OK a few days ago.  The problem occurs when the typedef is used to
define the member function.

template <class T> struct A {
    void f();
};
typedef A<int> Ai;
#if 0
void A<char>::f() { } // This works
#else
void Ai::f() { } // Error here
#endif
template <class T> void A<T>::f() { }

I would be happy if someone knowledgeable would speak up as to weather my code
is in error.

Using the CVS egcs from 1998-07-17 on i686-pc-linux-gnu, I get:
> g++ -c test1.cpp
test1.cpp:8: new declaration `void Ai::f<int>()'
test1.cpp:2: ambiguates old declaration `void A<int>::f<int>()'


Btw, the bug I reported in
http://www.cygnus.com/ml/egcs-bugs/1998-Jul/0341.html 
seems to be fixed.  Thanks!

/ Tobias



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