This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Simple program won't compile
- To: gcc at gcc dot gnu dot org
- Subject: Simple program won't compile
- From: Rodrigo de Salvo Braz <braz at students dot uiuc dot edu>
- Date: Mon, 22 Jan 2001 00:26:34 -0600 (CST)
Hi,
This program doesn't compile in gcc, although it does in a Borland
compiler. Basically, I can't use iterators of containers that are
arguments of template functions. Does anyone knows why? Thanks in advance!
#include <iostream>
#include <list>
template <class Container>
void foo (Container& c)
{
list<char>::iterator j; // iterator ok.
Container a = c; // This is ok.
Container::iterator i; // THIS IS THE PROBLEM.
// Message: parse error before ';'
}
int main (char* argv[], int argc)
{
list<int> a;
foo(a);
return 0;
}