+1  A: 

The autostr that is returned from the function is a temporary. Temporary values can only be bound to references-to-const (const autostr&), but your reference is non-const. (And "rightly so".)

This is a terrible idea, almost none of the standard library is intended to be inherited from. I already see a bug in your code:

autostr s("please don't delete me...oops");

What's wrong with std::string?

GMan
So I'm screwed in other words? As soon as that auto_ptr becomes const it's almost un-usable. I wasn't aware of that rule.
fret
@fret: You can do what `auto_ptr` does, and introduce a utility class (`auto_ptr` has `auto_ptr_ref`) who's only purpose is to allow functions to return `auto_ptr`'s. But I'd hate to give a solution when the problem is in the design.
GMan
Yeah I understand that, I thought this implementation would actually use the auto_ptr_ref without having to copy it. My probably mistake belief is that stl will add a lot of bloat to my application in terms of download size. I'll revisit that and do some actual metrics this week to convince myself one way or another. I do have to be careful because I target VC6+VS2010/Win32, GCC/Linux and GCC/Mac all at the same time.
fret
@fret: Download size where? By the way, there is no "STL", there's the "Standard Library", STL is a misnomer. And the standard library is just that; standard. Every compiler you use (worth salt) with come with a (heavily tested and optimized) standard library, and I know GCC and VC do. You are guaranteed things about the behavior of the standard library, so you should feel free to use it; it's part of the language.
GMan
It's fairly well understood that the VC6 compiler's STL is buggy as hell. But there are other options out there, STLport etc.
fret
@fret: I didn't see you had VC6, sorry. VC6 is pre-standard and pretty terrible in general, why are you using it?
GMan
@gman: I like the speed on the IDE, haven't had issues with it really. But the writing is on the wall, which is why I've got my software building on VS2010 as well. But I get the grumpy users complaining that the VS2010 build is "twice" the size due to the CRT dll being part of the installer. Yeah it's 700kb or something, but thats what I'm dealing with. Other issues with 2010 are that I'm not going to buy the pro version (it cost how much! hahaha *gag*) and there is no standard version... so it's express for me and geez they killed the JIT debugging support. So I'm still if'y about it.
fret
@fret: You could still probably try CS2008, it lacks the subset of C++0x features VS2010 implements but is otherwise perfectly usable. Any new version is better than VC6. Sorry to hear you're getting complaints from people stingy about their enormous amount of storage. :)
GMan