title: Clang compiler error constructing object with operator T*
body: <p>I am getting a strange compiler issue in clang (xcode). I just stripped down the code to just highlight the issue. When I construct the object I get an error in clang alone but works fine in msvc. </p>
  
  <p>In the below code msvc correctly resolves the operator T* in the base and uses that to construct the derived in both the below cases. But clang wierdly allows only the second variant.</p>
  
  <p>IDerivedT2 spDerived = spB;  //Error</p>
  
  <p>IDerivedT2 spDerived(spB);   //Works </p>
  
  <pre><code>struct IBase    {      };
  
  template &lt;typename T&gt;
  struct CContainer
  {
      CContainer() {}
      CContainer(T* p) {}
  
      CContainer&amp; operator=(T* p)
      {
          return *this;
      }
  
      CContainer&amp; operator=(CContainer&amp; p)
      {
          return *this;
      }
  
      operator T*()
      {
          return nullptr;
      }
  };
  
  template &lt;typename T&gt;
  struct CContainerDerived : public CContainer&lt;T&gt;
  {
      CContainerDerived() : CContainer&lt;T&gt;() {}
      CContainerDerived(T* p) : CContainer&lt;T&gt;(p) {}
      CContainerDerived(IBase* p) { *this = p; }
  
      CContainerDerived&amp; operator = (IBase* p)
      {
          return *this;
      }
  };
  
  struct IDerived : public IBase    {      };
  
  typedef CContainer&lt;IBase&gt; IBaseT1;
  typedef CContainerDerived&lt;IDerived&gt; IDerivedT2;
  
  int main()
  {
      IBaseT1 spB;
      IDerivedT2 spDerived = spB;  //Error
  
      //IDerivedT2 spDerived(spB);   //Works
  
      //IDerivedT2 spDerived;   //Works
      //spDerived = spB;
  
      std::cout &lt;&lt; "Hello, world!\n";
  }
  </code></pre>
  
  <p><a href="http://rextester.com/VEVST22502" rel="nofollow noreferrer">http://rextester.com/VEVST22502</a> (clang)</p>
  
  <p><a href="http://rextester.com/ZOMDU93964" rel="nofollow noreferrer">http://rextester.com/ZOMDU93964</a> (msvc)</p>
  
  <p>The version of clang compiler in my xcode is Apple LLVM version 7.3.0 (clang-703.0.29). The one in the rextester per commented code is 3.8. But behavior seems similar.</p>
  
  <p>Any reason why this happens on the clang alone ?</p>