When I single-step with the Visual Studio debugger through the following program, no return value is shown in the "auto" window for any of the istringstream
method calls.
It shows the return value for vector::size()
though.
#include "stdafx.h"
#include <sstream>
#include <vector>
int main()
{
std::vector<char>{}.size(); //<-- debugger shows return value
std::istringstream{"x"}.get(); //<-- no return value shown
std::istringstream{"x"}.good(); //<-- no return value shown
std::istringstream{"x"}.tellg(); //<-- no return value shown
return 0;
}
Of course I run this in "debug" configuration, so the compiler shouldn't be able to optimize the calls away. I created the project using console application wizard without changing any project settings afterwards.
Should I file a bug?
Edit:
Another possibly related issue: I can't F11-step into any of the above istringstream
methods. Debugger just steps over them as if I had pressed F10. Again, it works for vector::size()
.
It turns out that this was an issue of missing debug symbols when dynamically linking to the VC++ runtime. After a default installation of Visual Studio 2017, for instance, debug symbols for the VC++ runtime are not available.
Possible solutions:
I think the issue did not occur for std::vector
because it is header-only, so the code gets linked directly into the program executable. For the C++ stream library, much of the code actually is inside a VC runtime DLL.