title: Stream input operator causes Segmentation fault with clang but works with gcc
body: <p>The following code causes a segfault when it's compiled with clang and linked against libc++ but works fine when using libstc++ or compiling with gcc.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;iostream&gt;
  #include &lt;sstream&gt;
  
  class MyStream : public std::ostream {
  public:
      MyStream() {
          rdbuf( &amp;buffer );
      }
  
  private:
      std::stringbuf buffer;
  };
  
  int main() {
      MyStream stream{};
      stream &lt;&lt; "Hello world" &lt;&lt; std::endl;
      return 0;
  }
  </code></pre>
  
  <p><a href="https://wandbox.org/permlink/RxNBjQvPipDFJnTk" rel="nofollow noreferrer">Here is the code on wandbox</a></p>