parent
558e00272d
commit
d5d6da0dd4
|
@ -61,7 +61,7 @@ static bool isRaiiClass(const ValueType *valueType, bool cpp, bool defaultReturn
|
|||
if (!valueType)
|
||||
return defaultReturn;
|
||||
|
||||
if (valueType->smartPointerType && isRaiiClassScope(valueType->smartPointerType->classScope))
|
||||
if ((valueType->smartPointerType && isRaiiClassScope(valueType->smartPointerType->classScope)) || (!valueType->smartPointerType && valueType->type == ValueType::Type::SMART_POINTER))
|
||||
return true;
|
||||
|
||||
switch (valueType->type) {
|
||||
|
|
|
@ -5910,6 +5910,14 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:7]: (style) Variable 'a' is assigned a value that is never used.\n"
|
||||
"[test.cpp:8]: (style) Variable 'a2' is assigned a value that is never used.\n", errout.str());
|
||||
|
||||
functionVariableUsage("void g();\n" // #11094
|
||||
"void f() {\n"
|
||||
" auto p = std::make_unique<S>();\n"
|
||||
" p = nullptr;\n"
|
||||
" g();\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
// ticket #3104 - false positive when variable is read with "if (NOT var)"
|
||||
|
|
Loading…
Reference in New Issue