diff options
author | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-19 08:59:46 +0000 |
---|---|---|
committer | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-19 08:59:46 +0000 |
commit | 3cc399ab412f516965c6043295bf75cac8887ae5 (patch) | |
tree | 1691374444a74729eb3f65c7cc812507cbbcf05f /libstdc++-v3 | |
parent | b03ddc8f551a68851b424cf423226b06fff9ba11 (diff) | |
download | gcc-3cc399ab412f516965c6043295bf75cac8887ae5.tar.gz |
* include/bits/basic_string.h (operator[]): Allow s[s.size()] in
debug mode, but not pedantic mode.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99967 138bc75d-0d04-0410-961f-82ee72b054a4
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 08ff5caa882..ff614e30eed 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 b1fbaaac4d0..35dd364d969 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]; } |