Just to keep track of this tough issue, discussed in: http://gcc.gnu.org/ml/libstdc++/2005-05/msg00192.html
In a nutshell, this testcase doesn't assert and should: #define _GLIBCXX_DEBUG #include <string> int main() { std::string s; s[1]; } (change std::string to std::basic_string<short> and it does) -- Summary: basic_string vs debug_mode Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pcarlini at suse dot de CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21674