From: Paolo Carlini Date: Tue, 28 Mar 2006 12:54:04 +0000 (+0000) Subject: vstring.h (operator[]): Allow s[s.size()] in debug mode, but not pedantic mode. X-Git-Tag: releases/gcc-4.2.0~3535 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=df10833162384a6d8b9e7b1f67108c9c53e67d7f;p=thirdparty%2Fgcc.git vstring.h (operator[]): Allow s[s.size()] in debug mode, but not pedantic mode. 2006-03-28 Paolo Carlini * include/ext/vstring.h (operator[]): Allow s[s.size()] in debug mode, but not pedantic mode. From-SVN: r112447 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e2197bad5be6..4611906d75d1 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2006-03-28 Paolo Carlini + + * include/ext/vstring.h (operator[]): Allow s[s.size()] in + debug mode, but not pedantic mode. + 2006-03-24 Mark Mitchell Joseph S. Myers diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h index a117c5826eeb..5cd84b15a307 100644 --- a/libstdc++-v3/include/ext/vstring.h +++ b/libstdc++-v3/include/ext/vstring.h @@ -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]; }