I am evaluating 6.3, and I can’t get the proverbial 3 liner to compile:
#include <list>
#include <string>
#include <iostream>
using namespace std;
int main(void)
{
list<string *> foo;
string bar("BAR");
foo.push_back(new string(bar));
cout << *(*(foo.begin())) << endl;
}
compiled with:
QCC -V3.3.1,gcc_ntox86 -o list list.cc
Errors:
/usr/qnx630/target/qnx6/usr/include/cpp/list: In instantiation of std::list<std::string*, std::allocator<std::string*> >::const_iterator': /usr/qnx630/target/qnx6/usr/include/cpp/list:456: instantiated from
std::list<std::string*, std::allocator<std::string*> >::iterator’
/usr/qnx630/target/qnx6/usr/include/cpp/list:456: instantiated from
std::list<_Ty, _Ax>::iterator std::list<_Ty, _Ax>::end() [with _Ty = std::string*, _Ax = std::allocator<std::string*>]' /usr/qnx630/target/qnx6/usr/include/cpp/list:552: instantiated from
void std::list<_Ty, _Ax>::push_back(const _Ty&) [with _Ty = std::string*,
_Ax = std::allocator<std::string*>]’
list.cc:11: instantiated from here
/usr/qnx630/target/qnx6/usr/include/cpp/list:74: error: typedef class std::allocator<std::string*> std::_List_val<std::string*, std::allocator<std::string*> >::_Alty' is protected /usr/qnx630/target/qnx6/usr/include/cpp/list:456: error: within this context /usr/qnx630/target/qnx6/usr/include/cpp/list:74: error:
typedef class
std::allocator<std::string*> std::_List_val<std::string*,
std::allocator<std::string*> >::_Alty’ is protected
/usr/qnx630/target/qnx6/usr/include/cpp/list:456: error: within this context
/usr/qnx630/target/qnx6/usr/include/cpp/list:74: error: `typedef class
std::allocator<std::string*> std::_List_val<std::string*,
std::allocator<std::string*> >::_Alty’ is protected
/usr/qnx630/target/qnx6/usr/include/cpp/list:456: 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
What am I doing wrong ?
Needless to say the preceding compiles (and even works) on 6.2.1 with the following compiler invocation:
QCC -olist list.cc