I'm not sure I understand completely. I realised I was compiling without -D_GLIBCXX_DEBUG, after which, I get messages like (which is what I wanted):
Code:
c:\programming\mingw\mingw 9.2.0\include\c++\9.2.0\debug\vector:427:
In function:
std::__debug::vector<_Tp, _Allocator>::reference
std::__debug::vector<_Tp,
_Allocator>::operator[](std::__debug::vector<_Tp,
_Allocator>::size_type) [with _Tp = int; _Allocator =
std::allocator<int>; std::__debug::vector<_Tp, _Allocator>::reference =
int&; std::__debug::vector<_Tp, _Allocator>::size_type = long long
unsigned int]
Error: attempt to subscript container with out-of-bounds index 10000, but
container only holds 5 elements.
Objects involved in the operation:
sequence "this" @ 0x000000000023FD90 {
type = std::__debug::vector<int, std::allocator<int> >;
}
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Upon further reading, I came across stuff like -fsanitize=address and -fsanitize=undefined. I'm not sure I understand how to make it work yet but could you give a brief description on what it's supposed to do?