nkzxw / ontl

Automatically exported from code.google.com/p/ontl
0 stars 0 forks source link

basic_string::compare bug #51

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The return value of following function is wrong:
std::basic_string.compare(size_type pos, size_type n, charT* s);

#include <iostream>
#include <string>

int main(){
 std::string s("123");
 const int re = s.compare(0,2,"123");
 std::cout << re << std::endl;
 return 0;
}

http://codepad.org/4pApykR5

Original issue reported on code.google.com by icestudent@gmail.com on 5 Apr 2011 at 9:04

GoogleCodeExporter commented 9 years ago
gcc returns -1 (right), stlx returns 0 (wrong).

Original comment by icestudent@gmail.com on 5 Apr 2011 at 9:05

GoogleCodeExporter commented 9 years ago
Fixed at r805.

Original comment by icestudent@gmail.com on 5 Apr 2011 at 11:45