Closed Sleafar closed 8 months ago
The problem is in line 80 in return_type.hpp:
return &*_begin;
Creating a reference to past-the-end counts as accessing it, even if the only thing done is turning it back into a pointer.
It's completely harmless in practice, but yes, compilers tend to be whiny. C++11 added .data() to std::vector for exactly that reason. (Though I suspect that function isn't the solution here.)
@Sleafar can you try it now? (I don't have MSVC available)
@hanickadot I don't get the error anymore with the current main branch.
Thanks for reporting and the check!
Code to reproduce:
If this is run in debug mode with MSVC 19.37.32824, it triggers a check in _String_const_iterator.operator*() which detects out of range access. This problem seems only to occur for empty matches at the end of the data.