]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
vstring.h (operator[]): Allow s[s.size()] in debug mode, but not pedantic mode.
authorPaolo Carlini <pcarlini@suse.de>
Tue, 28 Mar 2006 12:54:04 +0000 (12:54 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 28 Mar 2006 12:54:04 +0000 (12:54 +0000)
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

libstdc++-v3/ChangeLog
libstdc++-v3/include/ext/vstring.h

index e2197bad5be67778636f4bec25dd10448932a58d..4611906d75d10abce8776b40b33cdd656b3aa185 100644 (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>
 
index a117c5826eebbb68dd7eda4e30b8fa7ae6bfb647..5cd84b15a30715c78fa2276a80b667b3c41b00a7 100644 (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];
       }