[Bug c++/18843] New: syntax error when getting iterator of an stl class (I tested with map)
cs dot f at freemail dot hu
gcc-bugzilla@gcc.gnu.org
Sun Dec 5 10:51:00 GMT 2004
Hi,
gcc version is: 3.3.3
possible bug:
Example code: test_template_map.cpp
#include <map>
#include <string>
template<class TMap>
bool CheckMap(TMap map)
{
TMap::const_iterator i;
i = map.find(12);
return i == map.end ? false : true;
}
using namespace std;
int main(int argc, char *argv[])
{
map<int, string> map;
bool b = CheckMap(map);
return EXIT_SUCCESS;
}
When I compile (g++ -save-temps test_template_map.cpp) this code than I get:
"/home/fec/Projektek/test_template_map/src/test_template_map.cpp:7: error:
syntax error before `;' token"
line 7 is: TMap::const_iterator i;.
I think this should compile, it should be: map<int, string>::const_iterator.
I have checked code: - TMap::iterator i; - I've got the same error message.
I checked the same example code on an other c++ compiler and it compiled
without error.
Kind regards,
Csaba
--
Summary: syntax error when getting iterator of an stl class (I
tested with map)
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: cs dot f at freemail dot hu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18843
More information about the Gcc-bugs
mailing list