Fix FP functionConst with extra parentheses (#3722)
This commit is contained in:
parent
cb5a50c6a7
commit
ca2e0ca287
|
@ -2135,6 +2135,8 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
|
|||
return false;
|
||||
|
||||
const Token* lhs = tok1->previous();
|
||||
if (lhs->str() == "(" && tok1->astParent() && tok1->astParent()->astParent())
|
||||
lhs = tok1->astParent()->astParent();
|
||||
if (lhs->str() == "&") {
|
||||
lhs = lhs->previous();
|
||||
if (lhs->isAssignmentOp() && lhs->previous()->variable()) {
|
||||
|
|
|
@ -445,7 +445,7 @@ private:
|
|||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (style) Struct 'A' has a constructor with 1 argument that is not explicit.\n", errout.str());
|
||||
|
||||
checkExplicitConstructors("struct Foo {\n"
|
||||
checkExplicitConstructors("struct Foo {\n" // #10515
|
||||
" template <typename T>\n"
|
||||
" explicit constexpr Foo(T) {}\n"
|
||||
"};\n"
|
||||
|
@ -5797,6 +5797,14 @@ private:
|
|||
" void g() { bar.f(k); }\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkConst("struct S {\n"
|
||||
" A a;\n"
|
||||
" void f(int j, int*& p) {\n"
|
||||
" p = &(((a[j])));\n"
|
||||
" }\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void const_handleDefaultParameters() {
|
||||
|
|
Loading…
Reference in New Issue