This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCC 3.3.1 and iterators compilation problem


Hi,

I have this very trivial example code of using a list container that won't
compile under GCC 3.3.1. It compiles just fine with no warnings under GCC
2.95.3.

I've hunted around and found references elsewhere to deprecated items in GCC
someplace around 3.3.1 with regards to iterators and templates. But no one
has mentioned any affects when not using templates.


#include <list>

using namespace std;

int main( void )
{
  int i;
  list<int> testList;
  list<int>::iterator iter;   // This line fails to compile!
	
  for (iter = testList.begin(); iter != testList.end(); iter++)
  {
      i = (*iter);
  }

  return 0;
}

This is the output of running GCC 3.3.1 on my machine (note, I can't upgrade
because QNX doesn't support anything newer than 3.3.1).

test1.cpp: In instantiation of `std::list<int, std::allocator<int>
>::const_iterator':
test1.cpp:9:   instantiated from `std::list<int, std::allocator<int>
>::iterator'
test1.cpp:9:   instantiated from here
/usr/qnx630/target/qnx6/usr/include/cpp/list:74: error: `typedef class 
   std::allocator<int> std::_List_val<int, std::allocator<int> >::_Alty' is 
   protected
test1.cpp:9: error: within this context
/usr/qnx630/target/qnx6/usr/include/cpp/list:74: error: `typedef class 
   std::allocator<int> std::_List_val<int, std::allocator<int> >::_Alty' is 
   protected
test1.cpp:9: error: within this context
/usr/qnx630/target/qnx6/usr/include/cpp/list:74: error: `typedef class 
   std::allocator<int> std::_List_val<int, std::allocator<int> >::_Alty' is 
   protected
test1.cpp:9: error: within this context
cc:
/usr/qnx630/host/qnx6/x86/usr/lib/gcc-lib/i386-pc-nto-qnx6.3.0/3.3.1/cc1plus
error 1

So it looks like there is some kind of weird scoping problem I am running
into that got added to the complier. But I can't understand why.

TIA,

Tim

--
View this message in context: http://www.nabble.com/GCC-3.3.1-and-iterators-compilation-problem-t1357413.html#a3635488
Sent from the gcc - libstdc++ forum at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]