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

    <tr>
        <th>Summary</th>
        <td>
            -Wconstant-logical-operand regression with comparison operators in C2x mode with Clang 17
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c2x,
            clang:frontend,
            regression,
            clang:diagnostics
      </td>
    </tr>

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

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

<pre>
    Basic programs involving constant comparisons produce `-Wconstant-logical-operand` with `-std=c2x` but not with `-std=c17`.
This program shouldn't produced `-Wconstant-logical-operand` because my understanding is that's for using boolean operations with integer operands, but these should both be booleans.
This is happening only in trunk and the clang 17 release, neither one produces the warning in clang 16.

(This program is reduced from a program with a constant `sizeof` comparison that was failing.)
```c
int main(int argc, const char **argv) {
    if ((1 == 1) && (argc == 1)) return 1;
    return 0;
}
```

Godbolt link demonstrating the regression: https://godbolt.org/z/e15rEc6r9

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVN2O6jYQfprJzQhkHDDJRS44S-kLVOq1Yw-JexwbeZzds_v0lUPYpVtVlRAEz-f5fuyJZnZDIOrg8AMO50rPeYypu8U0ePqI063qo33vfmh2Bm8pDklPjC68Rv_qwoAmBs46ZDRxuunkOAYuODsbQlBi8-cDsfFxcEb7TbxR0sGCEvjm8rigOFuoz0b-Kqv9nDHE_K_q7ghKbEGcQZz-GB0_9CCPcfY2gDzmB7f9f_KejJ6ZcHrHOVhKBWiLJ8eYR51BHhmvMeHMZbWP0ZMOuHTIrvhcBLqQaaCEa2cG-bI4yCMxrdKwj3nEnh5N-NmFYxz17UahsMTg39EFzGkOP1EHW_qg8ToMuDtiIk-aqXAEcnksvIEepnkBv-m0tHLhsU-tdOu3bP6RnmNMdM_smuKE-rOy-NNfZwxKsPugeC3xfR34kha-acardt6FYQuyXbmUuH_M_b8LGSftAsimPOo0mOJlYUAz6oQgTyBPOg2vIFuE44_7RkREd0WQDchmh1CfoT7jbsFIBVKVUmn3XCrVRHlOAXdQP3VaF8XnIhzP3wQ_J_Z7tH30Gb0LP9HSVNSWOxCGJfBEQyJmFwPUJxxzvjHUJ5AXkJfhvnUb0wDy8gHyQrtD-s2otCZU2a62bd3qirqdandCtG2jqrFT4mBlT21rrD4eaqNJ7fdK2foqLQnbVK6TQtaiEVKKQ7tX28bWfd83eyXqg6Gmh72gSTu_9f51KgoqxzxTp_b1QVVe9-R5mXspy-RJCfKlPJdLA_XpmmLIFOxn4cnnd6x1egiRszNcaodzlbrCuunngWEvvOPMXzqyy566_x7Pp0jvl_Dpst3nL6byFsIX-QunaOmOelnHpJqT776dg8vj3G9NnEBeio71Z3NL8S8yGeRlCYdBXpZ8_g4AAP__xNalww">