std::string construction/assignment

Hi, One of my unit tests is failing because following code throw an exception (gcc 3.2.3 linux): #include <list> #include <string> int main() { std::list<char> l; l.push_back( 'a' ); l.push_back( 'b' ); l.push_back( 'c' ); std::string( l.begin(), l.end() ); return 0; } Does it supposed to work? Is there workarounds? Gennadiy

Gennadiy Rozental wrote:
Hi,
One of my unit tests is failing because following code throw an exception (gcc 3.2.3 linux):
#include <list> #include <string>
int main() { std::list<char> l;
l.push_back( 'a' ); l.push_back( 'b' ); l.push_back( 'c' );
std::string( l.begin(), l.end() );
return 0; }
Does it supposed to work? Is there workarounds?
Yes, that should work. Looks like a bug in gcc 3.2.3; I can see the crash here, too. gcc 3.1, gcc 3.3.5 and gcc 3.4 work correctly (gcc 2.95.3 is unable to deal with the templates involved). Regards, m
participants (2)
-
Gennadiy Rozental
-
Martin Wille