#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main(int argc, char ** argv){
filebuf fb;
fb.open ("test.txt",ios::out);
std::ostream os(&fb);
std::string test("test");
os << test; // This line has the problem
fb.close();
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZnN0cmVhbT4KI2luY2x1ZGUgPHN0cmluZz4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbihpbnQgYXJnYywgY2hhciAqKiBhcmd2KXsKICAgIGZpbGVidWYgZmI7CiAgICBmYi5vcGVuICgidGVzdC50eHQiLGlvczo6b3V0KTsKICAgIHN0ZDo6b3N0cmVhbSBvcygmZmIpOwogICAgc3RkOjpzdHJpbmcgdGVzdCgidGVzdCIpOwogICAgb3MgPDwgdGVzdDsgLy8gVGhpcyBsaW5lIGhhcyB0aGUgcHJvYmxlbQogICAgZmIuY2xvc2UoKTsKfQ==