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

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] Inconsistent formatting of template parameter with ternary
        </td>
    </tr>

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

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

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

<pre>
    The following code gets formatted inconsistently.
`➜  ~ cat main.cpp`
```cpp
template <int num> void foo() {}

void bar() { return foo<true ? 1 : 2>(); }

int main() {
  bar();

  foo<true ? 1 : 2>();

  return 0;
}%     
```
`➜  ~ clang-format-18 main.cpp`
```cpp
template <int num> void foo() {}

void bar() { return foo < true ? 1 : 2 > (); }

int main() {
  bar();

  foo<true ? 1 : 2>();

  return 0;
}%     
```

The foo function call inside `bar()` is formatted differently than the one inside the `main` function.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUVMuO2zoM_Rp6Q8SQJT-ihReTSQLc_f0BxaZtFbIUSPIMZtNvL6R5JBOgQHdFg0CGKfIc8pikCkHPlqiH5gDNsVBbXJzvjzoE8i_aFhc3vvX_L4STM8a9ajvj4EbCmWLAyflVxUgjajs4G3SIZKN5K4EdgT1By-DEQZ5APiP-xEFFXJW25XC9prsvp_xPxmyJtF6NioQgnrWNaLcVxAlfnB5xcg74HrhE6A7QHT8w8pkdLsrfHNBT3LzNUeI5-i1hnrFCEE_IQZzeXUEc8AEr8aZU78iyHW8EIA73EfgHLN_9P5Jjt4vuCLzB9HvQ5jd6GmXn3ftH2FX7v6ZtAsPHujHh_mP65vO92R1Omx2idhYHZQxqG_RICC27Jdgy1PdDMOppIp8nAOOiLMaF0Fn6DE6v0LJcd8u-CMpi7MUohVQF9VXHupZxKWWx9FUrxH6qqZUDtaJpGFV7dumqth3YwLu60D1nvGa8Ypwz2chS8poxGlQj6mZsOgk1o1VpUxrzspbOz4UOYaN-X4l9Uxh1IRPy7HN-303AedoGvk9hu8s2B6iZ0SGGG1DU0eS98S2wOeJ_d7vgU520N9yEX-13VV6tFMnjq44LRvJW-bdi86ZfYrwGEE_Az8DPs47LdikHtwI_J-6Px-7q3Q8aIvBzrigAP-eifgUAAP__ZV1d8g">