This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
gcc2.95 - 3.2 conversion
- From: "Michael van Rooyen" <michael dot vanrooyen at babel dot co dot za>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Wed, 2 Jul 2003 23:28:31 +0200
- Subject: gcc2.95 - 3.2 conversion
I'm in the process of converting from gcc 2.95.x to gcc 3.2, and I'm having
a problem compiling the following bit of code that works fine under
gcc2.95.x. I've done a brief search of the archives, but haven't found
much of help. Does someone know why gcc doesn't like my 'iterator i'
declaration below? Thanks, I'm stumped...
#include <vector>
using namespace std;
template<class P> class pvector: public vector<P>
{
pvector(const pvector &);
pvector &operator = (const pvector &);
public:
pvector()
{
}
~pvector()
{
for (iterator i=begin(); i!=end(); i++) // This is the problem
line...
delete *i;
}
};
main()
{
pvector<char *> v;
}
Compiler output:
test.cc: In destructor `pvector<P>::~pvector()':
test.cc:19: parse error before `;' token
test.cc: In destructor `void pvector<P>::pvector() [with P = char*]':
test.cc:26: instantiated from here
test.cc:19: `i' undeclared (first use this function)
test.cc:19: (Each undeclared identifier is reported only once for each
function
it appears in.)