This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/5367: -pedantic switch causes template compilation to fail
- From: rodrigc at gcc dot gnu dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, leonid_d at mail dot ru, nobody at gcc dot gnu dot org
- Date: 13 Jan 2002 18:40:50 -0000
- Subject: Re: c++/5367: -pedantic switch causes template compilation to fail
- Reply-to: rodrigc at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, leonid_d at mail dot ru, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: -pedantic switch causes template compilation to fail
State-Changed-From-To: open->feedback
State-Changed-By: rodrigc
State-Changed-When: Sun Jan 13 10:40:49 2002
State-Changed-Why:
With gcc 3.0.3, if I compile your test case with:
g++ -pedantic -c test.cpp
I get the error:
test.cpp:7: warning: ISO C++ forbids declaration of `iterator' with no type
test.cpp:7: cannot declare member `std::map<Key, T*, std::less<_Key>,
std::allocator<std::pair<const Key, T*> > >::iterator' within
`TemplateA<Key, T>'
If I change the line:
typedef MyMap::iterator MyMapIterator;
to:
typedef typename MyMap::iterator MyMapIterator;
then it can compile.
Can you verify if this works for you?
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5367