Last active
May 16, 2018 10:44
-
-
Save ronen/e3cdeb966adc89bc7087b0145f0e19ca to your computer and use it in GitHub Desktop.
cppcheck false positive unused Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <functional> | |
#include <iostream> | |
int foo() { return 12345; } // FALSE POSITIVE: unusedFunction | |
int bar(std::function<int()> func) { return func(); } | |
class A { | |
public: | |
A() : a(bar([] { return foo(); })) {} | |
const int a; | |
}; | |
int main() { | |
std::cout << A().a << std::endl; // Correctly prints 12345 | |
} |
Author
ronen
commented
May 16, 2018
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment