Why function with return value can return nothing?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1610030/why-can-you-return-from-a-non-void-function-without-returning-a-value-without-pr">Why can you return from a non-void function without returning a value without producing a compiler error?</a>  </p>
</blockquote>



<p>Consider the real code:</p>

<pre><code>std::ostream &amp;operator &lt;&lt; (std::ostream &amp;stream, const sqc_var &amp;var)
{
    switch (var.type()) 
    {
        case sqc_var::type_number:
            return stream &lt;&lt; var.as_number();
        case sqc_var::type_string:
            return stream &lt;&lt; var.as_string();
        case sqc_var::type_object:
            stream &lt;&lt; "{";
            for (auto &amp;child : var.children())
            {
                stream &lt;&lt; child.name() &lt;&lt; ": " &lt;&lt; child.value() &lt;&lt; " "; // &lt;-- crash there
            }
            stream &lt;&lt;  " }";
    }

    //// return stream; &lt;-- originaly no return was there.
}
</code></pre>

<p>This code will crash program if <code>var</code> have an <code>type_object</code> type after first recursive call of <code>operator &lt;&lt;</code> because it returns nothing when the reference to <code>std::ostream</code> expected.</p>

<p>Clang 3.1 even does not print warning.</p>

<p>Modern GCC and MSVC print warning but compile it.</p>

<p><strong>Why C++ compiler allows such erroneous code?</strong></p>

<p>Also I'll be glad to see any references to C++ standard which allows such code or explanation when it can be usefull.</p>
