title: std::thread causes program to abort
body: <p>I have the following code snippet:</p>
  <pre><code>#include &lt;thread&gt;
  int main(){
      std::thread trial([](){ return 2;});
      //trial.join()
      return 0;
  }
  </code></pre>
  <p>From this I get the following output:</p>
  <pre><code>terminate called without an active exception
  [1]    17963 abort (core dumped)  ./a.out
  </code></pre>
  <p>Now, this doesn't happen when I call <code>.join()</code> after I create the thread. As far as I know, <code>.join()</code> waits until the execution of the thread ends. However, it also seems to prevent abort from happening. Could somebody explain what's going on?</p>