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

    <tr>
        <th>Summary</th>
        <td>
            Improve "Variable declaration in condition must have an initializer" error 
        </td>
    </tr>

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

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

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

<pre>
    Recently, I encountered this error in the below piece of code. My mistake was not serious (the first loop should be `for` not, `if`) but this diagnostic gives me no actionable information for fixing my obvious mistake.

`SmallVector<Constraint *> sortedConstraints;
    if (const auto &choice : getNestedConstraints()) { \\ error highlights choice here
      if (choice->isFavored())
        sortedConstraints.push_back(choice);
    }`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxlUk2PmzAQ_TXmMloEZknCgUM-GmkP7aGV9lrZZoDpGhzZJtv013cg2WTVImN7PJ55b55Hu-ZSf0eDY7QXIffwAjgaN40RPTYQewqA3jsPNLKFoNG6dzgRh4BrwbgGU_h6gYFCVG8I7yrA6CIE9OSmAEJu5rCWfIhgnTtB6N1kG04EYpW1zvM8R8zgvKWWJyEr0FO8wjekutGFSAY6OmOAAfk-KBPJjUpbZGqcZlCzDbxjsN80djBcwOnzwuLGLhXZQWTb27zKfgzK2lc0kVkU-70bQ_SKxsist6L4AsH5iM3jPIhidw0G_qidqzOzF9QUHVsr0ztiZUSxhQ7jNwz_xMsN1zaXJ9Y7EOWex03fnrre8h8D3JL0_AQPtDve4nxiehSO6uz4me5ZP9-G_9mnpyn0P7Uyb_c8c9DnmsT6wLokTV00VVGpJFK0WL8MJ-_OXJaUr8rTInqDxip_FZ17g2VoaDGGifXoFV9Xs4cPlaU_6Dn4VmoyeVv3MZ5Yz62QRx4dxX7SqXEDG9aeP5YnBv7FD8QmhTAhK3gsV4V8Tvo6z1WD2SbHaqNlLlFnui3MWpsSZV7kZWIVd2uoRbkT5SGhWmZSZussz2RRFUXalk25XqlVVuVVpUsjnjMcFNl0Bk6d7xJfLxz01AV2Wm6i8HCqEKgbET_ycwv0ztdq8BRPakwWvvVC9i_iDRtT">