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

2006-03-28  Paolo Carlini  <pcarlini@suse.de>

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

From-SVN: r112447
This commit is contained in:
Paolo Carlini 2006-03-28 12:54:04 +00:00 committed by Paolo Carlini
parent 37e47ee963
commit df10833162
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2006-03-28 Paolo Carlini <pcarlini@suse.de>
* include/ext/vstring.h (operator[]): Allow s[s.size()] in
debug mode, but not pedantic mode.
2006-03-24 Mark Mitchell <mark@codesourcery.com>
Joseph S. Myers <joseph@codesourcery.com>

View File

@ -449,7 +449,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
reference
operator[](size_type __pos)
{
_GLIBCXX_DEBUG_ASSERT(__pos < this->size());
// allow pos == size() as v3 extension:
_GLIBCXX_DEBUG_ASSERT(__pos <= this->size());
// but be strict in pedantic mode:
_GLIBCXX_DEBUG_PEDASSERT(__pos < this->size());
this->_M_leak();
return this->_M_data()[__pos];
}