Farid Zaripov wrote:
The problem in 21.string.rfind.cpp test is invoking string::rfind(const value_type* ptr, size_type off = npos, size_type count) with count == string::max_size() + 1 (21.string.rfind.cpp lines 413-416). The method throws length_error() exception (line 756 file string.cc) but test not expected any exceptions.
The test should definitely be prepared to deal with exceptions, even if they are not required or allowed. In this case I think it would be perfectly reasonable not to throw and return npos to indicate that the substring wasn't found. In fact, I believe would be more useful than to throw. IIRC, Anton and I discussed this but I don't see an issue about it in Jira. This thread might be relevant: http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg01244.html Martin