title: C++ polymorphism with boost scoped_ptr
body: <p>Why does the following code not allow foo(ptr) to be called ?</p>
  
  <pre><code>#include &lt;boost/scoped_ptr.hpp&gt;
  struct A {
      virtual ~A() {}
  };
  
  struct B: public A {};
  
  void foo(boost::scoped_ptr&lt;A&gt;&amp; a) {}
  
  void goo(A&amp; a) {}
  int main() {
      boost::scoped_ptr&lt;B&gt; ptr(new B);
      foo(ptr);
      B b;
      goo(b);
  }
  </code></pre>
  
  <p>The corresponding form where we pass references works as expected. Are we supposed not to do polymorphism
  with boost scoped_ptr ?</p>
  
  <p>g++ with boost 1.49 gives me:</p>
  
  <pre><code>error: invalid initialization of reference of type ‘boost::scoped_ptr&lt;A&gt;&amp;’ from expression of type ‘boost::scoped_ptr&lt;B&gt;’
  </code></pre>