This commit is contained in:
parent
51371f7929
commit
f53793c413
|
@ -304,6 +304,8 @@ void CheckOther::warningOldStylePointerCast()
|
|||
// Old style pointer casting..
|
||||
if (!Token::Match(tok, "( const|volatile| const|volatile|class|struct| %type% * const|&| ) (| %name%|%num%|%bool%|%char%|%str%"))
|
||||
continue;
|
||||
if (Token::Match(tok->previous(), "%type%"))
|
||||
continue;
|
||||
|
||||
// skip first "const" in "const Type* const"
|
||||
while (Token::Match(tok->next(), "const|volatile|class|struct"))
|
||||
|
|
|
@ -1503,6 +1503,12 @@ private:
|
|||
ASSERT_EQUALS("[test.cpp:4]: (style) C-style pointer casting\n"
|
||||
"[test.cpp:5]: (style) C-style pointer casting\n",
|
||||
errout.str());
|
||||
|
||||
// #10823
|
||||
checkOldStylePointerCast("void f(void* p) {\n"
|
||||
" auto h = reinterpret_cast<void (STDAPICALLTYPE*)(int)>(p);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
#define checkInvalidPointerCast(...) checkInvalidPointerCast_(__FILE__, __LINE__, __VA_ARGS__)
|
||||
|
|
Loading…
Reference in New Issue