A library "misbehaved" with a pass by reference, and it should not have compiled, why did it compile?
<p>I was using yaml-cpp, a yaml parsing library, and I was turning crazy because my yaml document was not being parsed entirely. Turns out it's because a constructor should have been given a reference, and not an object.</p>

<p>incorrect code :</p>

<pre><code>ifstr;
YAML::Parser parser(ifstream("items9.yml"));
</code></pre>

<p>correct code :</p>

<pre><code>ifstream ifstr("items9.yml");
YAML::Parser parser(ifstr);
</code></pre>

<p>The person told me it should not have compiled, I'm using visual C++ 10. Is this normal behaviour and should I be aware of it, or is the library wrongly designed or visual C++ wrongly accepting the code ?</p>
