My friend sent me a code where he says sucessfuly compiled in Windows. I tried on linux and it failed giving the error below. Below is a minimum verifiable example of the code.
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
std::stringstream ss, sl;
sl << ss;
}
but it gives
error: cannot bind ‘std::basic_ostream’ lvalue to ‘std::basic_ostream&&’
sl << ss;
Why it works in windows but not in linux, and why this error happens?