diff options
author | Jonathan Wakely <redi@gcc.gnu.org> | 2005-05-19 09:59:46 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2005-05-19 09:59:46 +0100 |
commit | bfbc811b25945fa82138ab678f4e1418726c45df (patch) | |
tree | 1691374444a74729eb3f65c7cc812507cbbcf05f /libstdc++-v3 | |
parent | a2391c6a3515ecf759f126ba37851b02122c8525 (diff) | |
download | gcc-bfbc811b25945fa82138ab678f4e1418726c45df.zip gcc-bfbc811b25945fa82138ab678f4e1418726c45df.tar.gz gcc-bfbc811b25945fa82138ab678f4e1418726c45df.tar.bz2 |
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
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 5 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/basic_string.h | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 08ff5ca..ff614e3 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +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. diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index b1fbaaa..35dd364 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -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]; } |