Will I break code when returning a copy instead of a const reference
<p>A framework I need to work with defines a simple mutex class that can store the mutex owner's name as an aid in debugging: </p>

<pre><code>class mutex
{
public:
    explicit mutex(const std::string&amp; mutex_owner = "");

    bool acquire() const;
    bool release() const;

    const std::string&amp; get_name() const {return owner_name_;}

    // ...

private:
    std::string owner_name_;

    // ...
};
</code></pre>

<p>I have just changed a few algorithms making the mutex type a template parameter so that I can pass in this one for performance reasons, if locking isn't needed: </p>

<pre><code>class non_mutex
{
public:
    explicit non_mutex(const std::string&amp; mutex_owner = "")     {}

    bool acquire() const               {return true;}
    bool release() const               {return true;}

    std::string get_name() const {return "";}
};
</code></pre>

<p>Since this one does not store a name (there's no need to debug this), I changed the <code>get_name()</code> member function to return a <code>std::string</code>, rather than a <code>const std::string&amp;</code>. </p>

<p>Now my question is: <em>Could this</em> (<strong><em>silently</em></strong>) <em>break anything?</em> The code compiles just fine, and seems to run fine, too, but there's few tests in this codebase, and this function is mostly only used if something goes amiss, rather than regularly. </p>

<p>What are the cases when this change could trigger runtime failures? </p>

<p>Note that this is a C++03 environment, but I'd be interested in C++11 answers, too.</p>
