title: c++ template casting with derived classes
body: <pre><code>#include &lt;vector&gt;
  
  struct A {int a;};
  struct B : public A {char b;};
  
  int main()
  {
    B b;
    typedef std::pair&lt;A*, A*&gt; MyPair;
    std::vector&lt;MyPair&gt; v;
    v.push_back(std::make_pair(&amp;b, &amp;b)); //compiler error should be here(pair&lt;B*,B*&gt;)
    return 0;
  }
  </code></pre>
  
  <p>I don't understand why this compiles (maybe somebody can kindly provide detailed explanation? Is it something related to name look-up?</p>
  
  <p>Btw, on Solaris, SunStudio12 it doesn't compile: <code>error : formal argument x of type const std::pair&lt;A*, A*&gt; &amp; in call to std::vector&lt;std::pair&lt;A*,A*&gt; &gt;::push_back(const std::pair&lt;A*, A*&gt; &amp; ) is being passed std::pair&lt;B*, B*&gt;</code></p>