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

    <tr>
        <th>Summary</th>
        <td>
            Clang crashes when having destructor called inside `__except`  block with`--async-exceptions`
        </td>
    </tr>

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

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

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

<pre>
    Here is the code and options I used to reproduce the problem: https://godbolt.org/z/8r8TYsbq7
While the code crashes at `calculateSEHStateForAsynchEH` I believe the actual problem is at `EHScopeStack`. There are two type of `SEH` scopes, `llvm.seh.try` and `llvm.seh.scope`, the problem seem to be that the scope of the temporary starts with `llvm.seh.scope.begin` and ends with `llvm.seh.try.end` which causes the crash.
Anyone knows which type of `SEH` scope should the temporary have?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0k0Fv4zgMhX-NfCFiyEriJAcfsm2N9JwCiz0VssRY2iqWV6SbTX_9QE47LTozpyDih0e-Z1IT-X5AbMT6L7G-L_TELqbmvNLJvRVdtNfmgAnBE7BDMNEi6MFCHNnHgeARJkILHCHhmKKdDM7gmGIX8CyWe3DMI4nlXqhWqLaPtouBy5h6odo3odpt2j79Q91_GyHvhdz_7XzAz2YmaXJIoBlELY0OZgqa8fhwOLJmbGPa03Uw7uEgagmP0GHw-HoT0IYnHT5myR5uKg-Ho4kjHlmbF1HLEp5c9qgTAl8i8HVEiKdMHm-ylHES6i6_hfB6LgldyemaizmOr88zLGqZ8S9RACGec1BdHk7zXJvZ3Cv_YTyPMel0BWKdmODi2f0qXXbY--GjMw72NyCna4mDzdDFeePA6Inw_RvmRMtb2PvhGgeElyFe6J38g3sgF6dgvw3q9CuKZVvYZml3y50usKk2crutlxtVFa5RaLvdycqdrE7d2lhbnVBqVLVebbqVsoVvlFQrqdS6UkrJqrQaUdaVOSmj0NYnsZJ41j6Us7eY-sITTdhs1a7aFEF3GGheXqVM0EMvlMp7nJrML7qpJ7GSwRPTpwJ7DtjcZfznfl0cDtmOH3qwSJwmwzGB0SGgBT-Qt5gzeX7G_w2OnIOBLkTzMqcvarlY6LyJi1s9X4eoZTGl0Hy7AM9u6koTz0K1eab3n8WY4r9oWKh2tkj5NrLLHwEAAP__SjM3Lw">