public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Error with stl
@ 2006-03-17 15:27 Michael Tomuschat
  2006-03-17 15:33 ` Andrew Pinski
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Tomuschat @ 2006-03-17 15:27 UTC (permalink / raw)
  To: gcc-bugs

Hello,

I've got a problem compiling the following source

michael@querx:~/tmp/xxx> g++ -Wall -O2 b.cpp
b.cpp: In member function ‘void bCls<T>::DumpItems()’:
b.cpp:15: error: expected `;' before ‘aIter’

When I compile this code with borland's bcc it compiles without complaining. 
So I think it might be an error in g++ or it's because I just start 
programming in C++.

Hope You can help me, sicerely

        Michael Tomuschat


Here is the code:

# File b.cpp
#include <vector>
using std::vector;

template <class T> struct aCls {
   T val;
   aCls( T v) { val = v; }
};

template <class T> class bCls {
public:
   bCls( void) {}
   vector <struct aCls<T> > bLst;
   void AddItem( T v) { bLst.insert( bLst.end(), v); }
   void DumpItems( void) {
      vector<class aCls< T> >::iterator aIter;  // ???? tut nicht ????
   }
};

int main( void) {
   bCls<int> B;

   for( int i = 0; i < 10; i++) B.AddItem( i);
   return -1;
}

I'm using gcc:
michael@querx:~/tmp/xxx> g++ --version
g++ (GCC) 4.0.2 20050901 (prerelease) (SUSE Linux)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



-- 
Dipl. Ing. Michael Tomuschat

Ing.-Büro Tomuschat             Tel.  : 07071-943866
Steinbößstr. 23                 Fax   : 07071-943867 (wenn Büro besetzt ist)
72074 Tübingen                  E-mail: michael.tomuschat@planet-interkom.de


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Error with stl
  2006-03-17 15:27 Error with stl Michael Tomuschat
@ 2006-03-17 15:33 ` Andrew Pinski
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Pinski @ 2006-03-17 15:33 UTC (permalink / raw)
  To: Michael Tomuschat; +Cc: gcc-bugs


On Mar 17, 2006, at 10:33 AM, Michael Tomuschat wrote:

>       vector<class aCls< T> >::iterator aIter;  // ???? tut nicht ????

You forgot the typename keyword.
It should be:

typename vector<class aCls< T> >::iterator aIter;


-- Pinski


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-03-17 15:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-17 15:27 Error with stl Michael Tomuschat
2006-03-17 15:33 ` Andrew Pinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).