Issue 127776
Summary [clang-tidy] misc-const-correctness false positive for map insertion with key from templated function
Labels clang-tidy, false-positive
Assignees
Reporter pkaff
    It seems there's a false positive for misc-const-correctness when insertion into a map occurs with a key coming from a templated function.

`#include <unordered_map>

template <typename T>
int f()
{
    return 3;
}

template <typename T>
void func()
{
    std::unordered_map<int, int> map;

    map[f<T>()] = 3;
}

int main() {
 func<int>();
}
`
Reproducer in godbolt: https://godbolt.org/z/xYT5z1hnf.

Of course, adding const to the map will cause a compilation error.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to