Commit bfbc811b by Jonathan Wakely

basic_string.h (operator[]): Allow s[s.size()] in debug mode, but not pedantic mode.

	* include/bits/basic_string.h (operator[]): Allow s[s.size()] in
	debug mode, but not pedantic mode.

From-SVN: r99967
parent a2391c6a
2005-05-19 Jonathan Wakely <redi@gcc.gnu.org>
* include/bits/basic_string.h (operator[]): Allow s[s.size()] in
debug mode, but not pedantic mode.
2005-05-19 Jan Beulich <jbeulich@novell.com>
* libsupc++/unwind-cxx.h: Include cstdlib.
......
......@@ -695,7 +695,10 @@ namespace std
reference
operator[](size_type __pos)
{
_GLIBCXX_DEBUG_ASSERT(__pos < size());
// allow pos == size() as v3 extension:
_GLIBCXX_DEBUG_ASSERT(__pos <= size());
// but be strict in pedantic mode:
_GLIBCXX_DEBUG_PEDASSERT(__pos < size());
_M_leak();
return _M_data()[__pos];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment