Dear sir/madam,
I'd like to report a bug I encountered some time ago (In SuSE linux 10.0, but the g++ was probably a bit old), I tested it again today with MinGW latest version (in Windows, of course) and I see the problem persists. So I decided I report the bug.
So, here's the bug:
If you have a class template of class, say, T, and have a variable inside that is a template variable of the same T. Now suppose you have a function inside the class template which needs a variable of type variable<T>::some_class. Then the variable would be unrecognized by g++ and produces errors.
Here is a sample code:
#include <iostream>
#include <list>
using namespace std;
template<class T>
class xl
{
public:
list<T> l;
void dump()
{
for (list<T>::iterator i = l.begin(); i !=
l.end(); ++i)
cout << ((i == l.begin())?"":" ") << *i;
}
};
int main()
{
xl<char *> x;
x.l.push_back("Bug!!");
x.dump();
cout << endl;
return 0;
}
Just changing the T inside the class template to char * for example, will solve the problem. So the error is not related to any part, except what I explained.
Thank you for your efforts,
Shahbaz Yousefi
Looking for a deal?
Find great prices on flights and hotels with Yahoo! FareChase.