This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] Small tweak to ext/vstring.h


Hi,

tested x86-linux, committed mainline & 4_1-branch.

Paolo.

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

	* include/ext/vstring.h (operator[]): Allow s[s.size()] in
	debug mode, but not pedantic mode.
Index: include/ext/vstring.h
===================================================================
--- include/ext/vstring.h	(revision 112441)
+++ include/ext/vstring.h	(working copy)
@@ -449,7 +449,10 @@
       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];
       }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]