summaryrefslogtreecommitdiffstats
path: root/libcxx
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2012-12-31 20:09:48 +0000
committerHoward Hinnant <hhinnant@apple.com>2012-12-31 20:09:48 +0000
commit861f006d3f103cc12d450943c71b210b55ae4dd9 (patch)
tree95937cbf7e92511b89d72e849ca61f364fc733f7 /libcxx
parentda3e31a4196829b5134d2725b6d27ce057ec7831 (diff)
downloadbcm5719-llvm-861f006d3f103cc12d450943c71b210b55ae4dd9.tar.gz
bcm5719-llvm-861f006d3f103cc12d450943c71b210b55ae4dd9.zip
Klaas de Vries: Fix bug in libc++'s std::string::find_first_not_of.
llvm-svn: 171321
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/include/string2
-rw-r--r--libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/libcxx/include/string b/libcxx/include/string
index 5bf42f023a4..1a70467940c 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -3374,7 +3374,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
{
const_pointer __p = data();
const_pointer __pe = __p + __sz;
- for (const_pointer __ps = __p + __pos; __p != __pe; ++__ps)
+ for (const_pointer __ps = __p + __pos; __ps != __pe; ++__ps)
if (!traits_type::eq(*__ps, __c))
return static_cast<size_type>(__ps - __p);
}
diff --git a/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp b/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp
index 88ce6b9817b..3be9e92d646 100644
--- a/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp
+++ b/libcxx/test/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp
@@ -59,6 +59,8 @@ int main()
test(S("oselktgbcapndfjihrmq"), 'q', 21, S::npos);
test(S(""), 'q', S::npos);
+ test(S("q"), 'q', S::npos);
+ test(S("qqq"), 'q', S::npos);
test(S("csope"), 'q', 0);
test(S("gfsmthlkon"), 'q', 0);
test(S("laenfsbridchgotmkqpj"), 'q', 0);
OpenPOWER on IntegriCloud