<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64346>64346</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [libc++] std::out_of_range thrown when calling str() && on default-constructed ostringstream
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            pfusik
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          pfusik
      </td>
    </tr>
</table>

<pre>
    ```cpp
// ./bin/clang++ -std=c++20 /tmp/test.cc -g
#include <iostream>
#include <sstream>

int main() {
  std::ostringstream oss;
  std::cerr << std::move(oss).str();
  return 0;
}
```

fails with `libc++abi: terminating due to uncaught exception of type std::out_of_range: basic_string`

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsUu2OrCoQfJr2T2cMgjr6wx8zO9fX2CCici-CgWb37tufqPt1ztnEoDZUd1VRMkYzO607qO7A-TalaP4DzqF6ZDLR4kN31rLBj28d1Ox81LYBewC7Ae-B95gD7wfjgPfKSjcDvwO_4yXSCOKhzl_OEHhP67avOlKuFF7mjzbCOGXTqBHEk_GRgpYriH9-2o5_7h6rcYSr3Dk0wFuE6_2sIx4sbiBue1vj5hOOPkYQfx9SOoR9Coinr-LqXzTwZofwNo8Uzinf8EFTCg7ZZwmuj_ePD9O-s52ksRFfDS0INbNmeDdJDgbEDUmH1ThJxs04Jo3kMTkl07wQ6v-V3sh4h35Cetv0N4GJnv30HKSb9d5mkNGo51P1J4Fs7MTYilZmuivqlrVN04gyW7pJX0XTFKKtRVWMIxN8aLmurnq8Tm05TJnpOOOCNYwXFbsWZT5yUResqOu6mOqxLaBkepXG5ta-rLkPc2ZiTLqrS1HWmZWDtvGIWvXIQrcfugxpjlAyayLFLxgZskcov5yB6vGzUKQl-FeHr4t2qKS1u2mfV4TAa-A1eoejnmSydFHeRQpJkR7xt0hkKdhuIdriPuVI9mxoSUOu_Aq83-m9vy5b8P9qRcD7Q2IE3h8qfwUAAP__UHj_jg">