[Bug libstdc++/13084] class string with find(const char* cstr, size_type idx) member have different gcc 2.95 and gcc 3.3 behaviour
paolo at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Nov 18 09:04:00 GMT 2003
------- Additional Comments From paolo at gcc dot gnu dot org 2003-11-18 09:04 -------
I strongly suspect submitter is thinking about this kind of testcase
#include <string>
#include <cassert>
int main()
{
std::string aaa = "Francesca";
char* lit = "";
assert( aaa.find(lit) == 0 );
std::string str("");
assert( aaa.find(str) == 0 );
}
What happens here, is that v2's find returns 9 whereas v3 returns 0 (for
both the tests)
Now, 9 is definitely wrong since is past the end of the string aaa and
find is supposed to return aither a valid index inside aaa or string::npos.
However, I'm not deadly sure that 0 is correct: just let me think a bit more
about the issue...
Paolo.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |ASSIGNED
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-11-18 09:04:49
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13084
More information about the Gcc-bugs
mailing list