<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/80684>80684</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] Strict mode causes misleading redundant inline specifier warning
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
SunBlack
</td>
</tr>
</table>
<pre>
#73069 introduced a new warning [readability-redundant-inline-specifier](https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-inline-specifier.html). But when I try to fix the warnings in our project, when `Strict` is enabled, I'm getting compile issues by MSVC.
Following code is [compiling under MSVC](https://godbolt.org/z/6ajcMGWdP):
```cpp
namespace
{
class A
{
public:
static inline const float test = 3.0F;
};
}
int main()
{
A a;
return 0;
};
```
But when I run clang-tidy over this code, via:
```sh
clang-tidy-18 -checks='readability-redundant-inline-specifier' -config='{CheckOptions: [{key: readability-redundant-inline-specifier.StrictMode, value: true}]}' test.cpp -- -std=c++17
```
I'm getting:
```
test.cpp:7:10: warning: variable 'test' has inline specifier but is implicitly inlined [readability-redundant-inline-specifier]
7 | static inline const float test = 3.0F;
| ^~~~~~
```
When I remove the `inline` Clang-Tidy is happy (also when I remove the anonymous namespace), but than MSVC complains:
```
example.cpp
<source>(7): error C2864: '`anonymous-namespace'::A::test': a static data member with an in-class initializer must have non-volatile const integral type or be specified as 'inline'
<source>(7): note: type is 'const float'
Compiler returned: 2
```
The documentation of the warning [C2864](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-2/compiler-error-c2864) explicitly show an example with a floating point type - I have no idea why `inline` is required for floating point types and not for integral types, but as they have explicitly mentioned it, there must be a reason.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVk2P4jgQ_TXmUkoUHCBw4MDHsJrDaFfq0c7ZsQviacfO2g40c9jfvqokBHq6tzUTIcBOffnV87NFCPpkEddsvmXz_US0sXJ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