title: Weird behavior in function overload resolution with const keywords for template arguments
body: <p>So I have been reading <code>Programming Principles and Practices in C++</code> by Bjarne. And the section on conversion of templated objects of base/derived classes got me kinda confused. So I tried to try out different combinations and stumbled on something weird </p>
  
  <pre><code>#include &lt;iostream&gt;
  
  class A {
  public:
      int i;
  };
  
  class B : public A {
      int j;
  };
  
  template&lt;typename T&gt;
  class Array_ref{
  public:
  
      Array_ref(T* pointer, int size) : p{pointer}, sz{size} {}
      template&lt;typename Q&gt;
      operator Array_ref&lt;const Q&gt;(){
          static_cast&lt;Q&gt;(*static_cast&lt;T*&gt;(nullptr));
          return Array_ref&lt;const Q&gt;{reinterpret_cast&lt;Q*&gt;(p), sz};
      }
      T&amp; operator[](int n){ 
          return p[n];
      }
  private:
      T* p;
      int sz;
  };
  
  void test_function(Array_ref&lt;A* const&gt; temp){
      if(temp[0]-&gt;i)
          std::cout&lt;&lt;"failed I guess"&lt;&lt;std::endl;
      exit(0);
  };
  
  int main(){
      B* testobj[1];
      testobj[0] = new B;
      testobj[0]-&gt;i = 0;
      Array_ref&lt;B*&gt; a(testobj, 1);
      test_function(a);
      delete testobj[0];
      exit(0);
  }
  </code></pre>
  
  <p>The <code>void test_function(Array_ref&lt;A* const&gt; temp)</code> is the line that troubled me. Since if I made it <code>Array_ref&lt;const A*&gt;</code> it fails to compile with the error that it can't convert from <code>B*</code> to <code>const A*</code>, though as far as I know, I have provided the conversion rule which should fit the overloading arguments. In fact, aren't <code>const A*</code> and <code>A* const</code> very different things?</p>
  
  <p>I would be glad if someone can help me out with where I am messing up, and what I missed out. Thanks a bunch!</p>