Can C++ have line numbers for std::vector index out of bounds acesses?

Revision en1, by AQZZ, 2020-06-16 21:58:40

Currently I compile with these flags: alias bd='g++ -std=c++17 -Wshadow -Wall -Wextra -o "a" -g -fsanitize=address -fsanitize=undefined'

Most of the time when I access an out of bounds index I get an error from the sanitizer that tells me the line number, which is good. But sometimes I just get an error that memory is leaked but I get no line number. Are there any flags/compilers which can print the line number consistently when this error occurs, similar to Java's index out of bounds exception?

Tags c++, c++ compilers

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English AQZZ 2020-06-16 21:58:40 576 Initial revision (published)