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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] false positive when using default comparisons
        </td>
    </tr>

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

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

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

<pre>
    Consider the following program:

`test.cpp`:
```
#include <compare>

struct Test {
  int X;
  friend auto operator<=>(const Test& LHS, const Test& RHS) = default;
};

bool test() {
  return Test{1} < Test{2};
}
```

and clang-tidy config:

`config`:
```
Checks: 'readability-identifier-naming'
CheckOptions:
  - key:             readability-identifier-naming.VariableCase
    value:           CamelCase
```

Running

```
clang-tidy test.cpp -config-file=config -- -std=c++20
```

results in the following warning:

```
test.cpp:5:69: warning: invalid case style for variable 'cmp' [readability-identifier-naming]
  friend auto operator<=>(const Test& LHS, const Test& RHS) = default;
                                                                    ^
                                                                    Cmp
```

I assume that this comes from the code generated for the default implementation, but I would not expect warnings in that code.

This happens when using clang-tidy 15.0.1 built from source:

```
% clang-tidy --version
LLVM (http://llvm.org/):
  LLVM version 15.0.1
  Optimized build with assertions.
  Default target: x86_64-unknown-linux-gnu
  Host CPU: znver2
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy9VVuPmzoQ_jXOywjEJSTkgYdu0qqVtmrVm87bkYGB-KyxkW02m_76joEkbC_7VB1EHNtjf_PNN2NT6vpc7LWyokYD7ojQaCn1SagWeqNbwzuWvmLRgUWXdhM5tC6s-p66NyP1p3caJqlQlRxqBJbuK9313CBLXy-RrDND5eALoQHb3k2TAEI5-Iel13FjBKoa-OA06B4Nd9oQJksPHi_JK2I_obBkA_dvP7NkD88nP_nJHTE5QI0NH6S74rPt4dYf21JrCW7cmY-7btQMusGoCXZ7F9NeH91lnDzDov5vh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