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

    <tr>
        <th>Summary</th>
        <td>
            clang -Wconstant-conversion conditional operator false positive
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    The following C source code:

```c
int x = 0 ? 9223372036854775807L : 2147483648;
```

Produces the following warning when compiled with Clang:

```console
$ clang --version
clang version 16.0.6 (Fedora 16.0.6-2.fc38)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ clang -Wconstant-conversion -fsyntax-only test.c
test.c:1:13: warning: implicit conversion from 'long' to 'int' changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
int x = 0 ? 9223372036854775807L : 2147483647;
    ~       ^~~~~~~~~~~~~~~~~~~~
1 warning generated.
```

`0 ? 9223372036854775807L : 2147483647` evaluates to `2147483647L`, so this warning is incorrect. GCC's similar `-Woverflow` doesn't trigger for this test case.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVM-v4yYQ_mvwZWTLHmzsHHx4P-qq0h56WGmPFYGxTUUgApzkXfZvr4izb7fd7aoqSgzMDB8fzDfIGM3iiEbWPbPutZBbWn0YfZRO-0tx9Ppt_LgSzN5afzVugReIfguKQHlNjD-x-pXVX76i3n9qnxuX4AaMv0INjE9wQOS8x5qLoWv7vhvq_gMw_gTYtH07cNEOjD__A-vbDX4PXm-KIqS_cbrK4O79Sg6UP52NJQ1Xk1Z4sdIt_0rTu-gtPazYgsrRUJYXCtF4tzt248MEjajqSgDDYSLtg3wYSqxmxQeGh33RRxkWSvlst0H8IdoykF5lKq1x261c3PYIWwNJDSevyebgs4_mtrt-czFJa0m_mpBdDKctBobT0bjvGH_KR0nSpVJ594VqOcc3l-St9M6-QaKYqkdiHmP-1OQ_z_CPO8xDczpbo0yCb7Dm4E_AsLfeLQx7SD7PjEt5olbpFopwkXajPfQHqc5rygZY9_xDuqx7_b-q6d9VAwDwGfbGul8-f9_2uOZdMws5CjKRrn6iOybq_85F1ED5JmTKQvXARP3V-yEjYy4iSKuJ7zRMBOOUD4FUquDXlxeGfYRoTsbKkCHKT_5CYbb-mjfQnqJj2CdIwSwLBZh92BFzbkHJSFWhR64P_CALGhtxQGwOLcdiHetDhyjEjHo-Du2gu1YfGyWVONaIDc2FGbFGXg-NwLrrG6z0wIdBzJIrrfiBGtbWdJLGVtZeTpUPS2Fi3GgUbd82hZVHsvH-piA6usLdyRDzExPGvKY8bktkbW1NTPErSjLJ0vgzUSvvtEnGO2nBn3PqfIBZ2kj34knmQsUW7LimdI658HFiOC0mrduxUv7EcMq7PbryHPyfpBLD6c4xMpzuZ_grAAD__7NhiNE">