title: why can static_cast compile casting raw pointers to smart pointers
body: <p>I just stumbled into a cast from a smart pointer and wanted to check if <code>static_cast</code> could assert at compile time that the following is nonsensical:</p>
  
  <pre><code>int main()
  {
      char foobar[4] = "Foo";
      std::unique_ptr&lt;char[]&gt; myptr = static_cast&lt;decltype(myptr)&gt;(foobar);
      myptr.reset();
      return 0;
  }
  </code></pre>
  
  <p>What happens here is that <code>myptr</code> attempts to free <code>foobar</code>.</p>
  
  <p>I am not asking what a smart pointer is or how to allocate or otherwise fix the above.</p>
  
  <p>I thought this problem should be caught at compile time, since these types should be completely incompatible.</p>
  
  <p>Why is this not detected at compile time?</p>