echo '#include <auto_ptr.h>' | g++ -std=gnu++0x -S -o /tmp/a.s -xc++ - worked in 4.7, but doesn't work any longer in 4.8. Apparently the snapper package does this in one of the translation units (no idea why). Is that an error in the package and it isn't supposed to include that header, or is that something to fix on the libstdc++ side? The problem started with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190109 where auto_ptr.h relies on a couple of headers it doesn't include itself (so _Lock_policy, __shared_count etc. aren't defined).
It's an error in the package and only worked "by accident" because $PREFIX/include/c++/4.x.y/backward is in the include path, to allow <strstream> to be found. The only supported way to use std::auto_ptr is #include <memory>
The header even says so, and has done so for years: /** @file backward/auto_ptr.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{memory} */ The change was an important one that allows us to use unique_ptr and shared_ptr internally in the library (e.g. in <future>) without depending on the whole of <memory> and without pulling in the deprecated auto_ptr definition, as discussed in the thread beginning at http://gcc.gnu.org/ml/libstdc++/2012-06/msg00078.html I don't want to revert it, and it would contradict how the entire library is structured to make <backward/auto_ptr.h> pull in all its needed headers. If you #include <memory> it works perfectly, anything else is unsupported.
I have no problem with that, just noticed this during mass rebuild with gcc 4.8 and wanted to double check where the bug is.