fix #2807 (Wrong handling of function references when prefixed with &)
This commit is contained in:
parent
1286898fa0
commit
6eecab5d73
|
@ -662,7 +662,7 @@ void CheckClass::privateFunctions()
|
|||
while (!FuncList.empty())
|
||||
{
|
||||
// Final check; check if the function pointer is used somewhere..
|
||||
const std::string _pattern("return|(|)|,|= " + FuncList.front()->str());
|
||||
const std::string _pattern("return|(|)|,|= &|" + FuncList.front()->str());
|
||||
|
||||
// or if the function address is used somewhere...
|
||||
// eg. sigc::mem_fun(this, &className::classFunction)
|
||||
|
|
|
@ -45,6 +45,7 @@ private:
|
|||
TEST_CASE(func_pointer1);
|
||||
TEST_CASE(func_pointer2);
|
||||
TEST_CASE(func_pointer3);
|
||||
TEST_CASE(func_pointer4); // ticket #2807
|
||||
|
||||
TEST_CASE(ctor);
|
||||
|
||||
|
@ -298,6 +299,21 @@ private:
|
|||
}
|
||||
|
||||
|
||||
void func_pointer4() // ticket #2807
|
||||
{
|
||||
check("class myclass {\n"
|
||||
"public:\n"
|
||||
" myclass();\n"
|
||||
"private:\n"
|
||||
" static void f();\n"
|
||||
" void (*fptr)();\n"
|
||||
"};\n"
|
||||
"myclass::myclass() { fptr = &f; }\n"
|
||||
"void myclass::f() {}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
|
||||
void ctor()
|
||||
{
|
||||
check("class PrivateCtor\n"
|
||||
|
|
Loading…
Reference in New Issue