[ http://issues.apache.org/jira/browse/STDCXX-294?page=all ] Martin Sebor resolved STDCXX-294. --------------------------------- Fix Version/s: 4.2 Resolution: Fixed Fixed. > std::vector(iterator, size_type, value_type) corrupts data > ---------------------------------------------------------- > > Key: STDCXX-294 > URL: http://issues.apache.org/jira/browse/STDCXX-294 > Project: C++ Standard Library > Issue Type: Bug > Components: 23. Containers > Affects Versions: 4.1.2, 4.1.3 > Environment: all > Reporter: Martin Sebor > Assigned To: Martin Sebor > Priority: Critical > Fix For: 4.2 > > > The program below aborts at runtime: > $ cat t.cpp && make t && ./t > #include > #include > int main() > { > static const int a[] = { 1, 2, 3, 4, 5 }; > std::vector v (a, a + sizeof a / sizeof *a); > v.insert (v.begin () + 2, 2, -1); > static const int b[] = { 1, 2, -1, -1, 3, 4, 5 }; > assert (v == std::vector(b, b + sizeof b / sizeof *b)); > } > gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/dev/stdlib/include -I/build/sebor/gcc-4.1.0-11s/include -I/build/sebor/dev/stdlib/examples/include -pedantic -nostdinc++ -g -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long t.cpp > gcc t.o -o t -L/build/sebor/gcc-4.1.0-11s/lib -lstd11s -lsupc++ -lm > Assertion failed: v == std::vector(b, b + sizeof b / sizeof *b), file t.cpp, line 12 > Abort (core dumped) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira