<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/148289>148289</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] `readability-redundant-inline-specifier`: with modules, `inline` on in-class member function definitions is not always redundant
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
localspook
</td>
</tr>
</table>
<pre>
Consider this class:
```cpp
struct s {
void f() {}
};
```
In a non-module world, `f` is implicitly `inline`, and writing the keyword is redundant.
But C++20 adopted [P1779](wg21.link/p1779), which changes the semantics of this code: when `s` is not attached to the global module, `f` is not `inline`; if you want it to be, you have to say so explicitly. This does not apply to defaulted member functions however:
```cpp
struct s {
inline s() = default; // Still redundant.
};
```
So I believe this check should not trigger outside the global module and when the function isn't defaulted. (We may even want to add a check like `modernize-modules` that *adds* `inline` to ease the transition to modules.)
Godbolt: https://godbolt.org/z/Gv9YGzq9e
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVE2PszYQ_jXOZZQITEjgwIFslNV7q_RWqno0eALTNTa1h1D211cmSfejPVSKFGnwjJ8vjwqBOotYifwk8vNGTdw7XxnXKhNG5942jdNL9eJsII0euKcArVEhiKwWSS0Oyf3XjqNI6sB-ahkCiONJJDUAwM2RhquQhZDlWj6eY9_xLLLT5wEiqX9YUGCd3Q5OTwZhdt5oIV9AHJKrOCRAAWgYDbXEZolVsoYsxm75AspqmD0x2Q64R3jDZXZexy6PerJaWd6JpD5NDC9CnoQ8yQSUdiOjBpGffkmPx1LkZyGLuZPpzpB9E_IyrmVZxjvmntoe2l7ZDsN6S8BBWaY2gLs-5HEaRVbD3KONIMMDunUMilm1PWpgt3Z3xjXKwJ3wN6rx_BeO2QnoCoubYFaWgThOada2WOzVDWMlqAWCA_zrqdQOfo24tMMHiHE0Szyp8aomE9kPODTo4TrZlsnZAL2b8Yb-_7p8Bwnh6XN2fg6PqIW8CHmBn0zGfPXiP3Pw08EPaNAQRkKrpD22bxB6Nxm9UmBPXYce3MQxmP_W8p6G6ED89OQFFKyQR_5gvgMhi98QBrUA3tDepWUHSmtQj4sNvWG0YnAavaV3fCR0dZZ7xSBkrbQOQtZfLIuDUIU7PvbKBlphsHvADLsYrCSK_Op046JeNfTM4_rAVt26-4ed852Ql3chL6-38vfX9z9L3Ogq02VWqg1W6TGX8pCnWbbpK4WHIj0cUrXfq6Y4FPKAqtTXskyaomww31AlE5knxzSVSVrk2a5I1T7L06RNyzZXbSH2CQ6KzM6Y2xDv3lAIE1bpvpBFuTGqQRPWtSFla5Tttkx6EVLGNeKr2LVtpi6IfWIocPiYw8RmXTif2vJz1M2j0qohQ7xs_4nJ9q7mNozY0pXQr0-hhpm4f6r4eDkfuker7XZdVN-zHb0nS_eYP5-lmdXyaU1sJm-qby4Q91Oza90g5CVyefxtR-_-wJaFvKwCBSEvD41ulfw7AAD__6uauio">