+1  A: 

Looks like a compiler bug. You might want to try with the latest VC compiler (which at the moment is VC10 Beta2), and if it's not fixed, follow up with the VC team (you'll need a complete self contained repo). If it is fixed, you should just use the work around you found and move on with your life.

Terry Mahaffey
FWIW I repo on the latest VC10 bits as well. Looks like a compiler bug.
Terry Mahaffey
Thanks for trying
valerio
A: 

change

DataOutput *output(file.CreateOutput(false, false));

to

DataOutput* output = file.CreateOutput(false, false); and it might work. But to make this a reasonable lib function you don't have to clean up after you should not return a pointer but an actual object.

Charles Eli Cheese
Standard stream classes are non-copyable (`std::basic_ios` has private copy-constructor and copy-assignment operator), which means that with standard streams (or any streams built within the same approach) returning the stream itself by value is not an option. A smart pointer or a wrapper would work here, but that might be a different story, depending on the OP's design.
AndreyT
This didn't work in VC7. But there are a lot of workarounds like adding <code>*output</code> or <code>output->SomeMethod()</code> before both calls that seem to do.As for the design part, this is not actual code, it is my attempt to reproduce the bug. In the original code that same method returns a smart pointer to a base class, and the method itself is virtual for allowing classes other than <code>File</code> to return different stream-derived objects.
valerio