Issue 235629
Summary [clang-tidy] misc-const-correctness false positive with empty template parameter pack
Labels clang-tidy, false-positive
Assignees
Reporter ixSci
    The following simple code:
```cpp
class A
{
public:
    void add(int)
 {}
};

template<int... Args>
void fun()
{
    A a;
    (a.add(Args), ...);
}

void f()
{
    fun();
}
```
Produces the following tidy's warning:
```
<source>:12:13: warning: variable 'a' of type 'A' can be declared 'const' [misc-const-correctness]
   12 |             A a ;
      | ^
      |               const 
```
Which is kinda correct because of how the function is called but not correct for any other `fun()` instantiation. So all in all it is a false positive. Godbolt to check: https://godbolt.org/z/PWzqqcq73
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to