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

    <tr>
        <th>Summary</th>
        <td>
            Clang-format using templates and greater than comparison
        </td>
    </tr>

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

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

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

<pre>
    I noticed some weird result when running clang-format on our code base.
The issue seems to be linked to the use of templates and a greater than comparison.
The following snippet is the code that needs to be formatted:

```
#include <iostream>
#include <tuple>

template <typename T>
auto test(T t) noexcept -> void {
 if constexpr (std::tuple_size_v<T> > 0)
        std::cout << "Not empty" << std::endl;
    else
        std::cout << "Empty" << std::endl;
}

int main(void) {
    test(std::tuple{});
 test(std::tuple{1, "g"});
}
```

[Link to compiler explorer](https://godbolt.org/z/9h9bedsb4)

Clang-format 13 (and also more recent versions it seems), changes the line 
`if constexpr (std::tuple_size_v<T> > 0)` into 
`if constexpr (std::tuple_size_v < T >> 0)`

The formatting has been set to Google, all other configuration options are just using default values.
Note: since tuple_size_v returns an unsigned integer, we changed our code to `if constexpr (std::tuple_size_v<T> != 0)` to work around this issue.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVVFv4joT_TXmZVQUHELIQx7aUj590tU-XPV95cSTxFvHE9nj0u6vv3JCgVZ3pd2LwCh4fOac45lBhWB6h1iL4kEUh5WKPJCv_ya0hvabVUP6vf4_OGLTooZAI8IJjdfgMUTLcBrQgY_OGddDa5Xr7zryo2IgBxQ9tKQRGhVwLbKDyO6fBwQTQkQIiGMAJmgQrHEvqNMDDwgxIFAHjONkFWMA5TQo6D0qRg88KActjZPyJpC7Ae7IWjolKsGZaUIGE2bEmQUPisEh6o-sC1NGLfL7BeS87rLze3mUuXGtjRpB5I-GAntUo8if_m2b42TxujevH0Lm_fcJnRoRni9BK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