It looks like the std::wstring support in the standard library for gcc/clang is kind of poor. Or am I doing something wrong here:
<code>#include <fstream>
#include <string>
int main()
{
std::string a;
std::ifstream ifs(a); // fine
std::wstring b;
std::ifstream ifs2(b); // compilation error gcc/clang
return 0;
}
</code>
<code>#include <fstream>
#include <string>
int main()
{
std::string a;
std::ifstream ifs(a); // fine
std::wstring b;
std::ifstream ifs2(b); // compilation error gcc/clang
return 0;
}
</code>
#include <fstream>
#include <string>
int main()
{
std::string a;
std::ifstream ifs(a); // fine
std::wstring b;
std::ifstream ifs2(b); // compilation error gcc/clang
return 0;
}
I tested this on godbolt and it basically only compiles under windows.
Do you know if this is by design? Are there any compiler switches I could use so that it will work?