Hi! Here's minimal repro:
class A {};
void poison(void(*f)() = []{}) {}
void foo() {
A a;
a = {};
poison();
}
I get following warning (godbolt: https://godbolt.org/z/cedY7o5ev):
<source>:4:5: warning: variable 'a' of type 'A' can be declared 'const' [misc-const-correctness]
4 | A a;
| ^
| const
1 warning generated.
Even though I assign to a on the next line. Something is wrong with calling a function with a function pointer type (or std::function) that defaults to a lambda, it completely messes up the check -- note that it does not even use a in any way. Following changes would remove the false-positive:
Thanks in advance! Let me know if any other information is needed.