This code is undefined, why is it running? How do i crash it?
<p>I ran the code below in visual studios and expected to get a runtime or some kind of error. I got nothing, absolutely nothing. I got the output code 9, comment that line out and got 3. I ran it on codepad and it gave me no errors as well.</p>

<p>Is there a compiler that will tell me this code is incorrect? If it is correct why is it? I know const A&amp; <a href="http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/" rel="nofollow">is legal</a> but AFAIK the below isnt.</p>

<pre><code>class A
{
public:
    int v;
    A&amp; get()
    {
        return *this;
    }
};

A&amp; func()
{
    A a;
    a.v=3;
    return a.get();
}

int main()
{
    A&amp; v = func();
    v.v=9;
    return v.v;
}
</code></pre>
