parent
0c51977f86
commit
640b561633
|
@ -1244,7 +1244,13 @@ static bool canBeConst(const Variable *var, const Settings* settings)
|
|||
const Function* func_scope = var->scope()->function;
|
||||
if (func_scope && func_scope->type == Function::Type::eConstructor) {
|
||||
//could be initialized in initializer list
|
||||
if (func_scope->arg->link()->next()->str() == ":") {
|
||||
const Token* init = func_scope->arg->link()->next();
|
||||
if (init->str() == "noexcept") {
|
||||
init = init->next();
|
||||
if (init->link())
|
||||
init = init->link()->next();
|
||||
}
|
||||
if (init->str() == ":") {
|
||||
for (const Token* tok2 = func_scope->arg->link()->next()->next(); tok2 != var->scope()->bodyStart; tok2 = tok2->next()) {
|
||||
if (tok2->varId() != var->declarationId())
|
||||
continue;
|
||||
|
|
|
@ -2150,6 +2150,18 @@ private:
|
|||
"[test.cpp:18]: (performance) Function parameter 'v' should be passed by const reference.\n",
|
||||
errout.str());
|
||||
|
||||
check("struct S {\n" // #11995
|
||||
" explicit S(std::string s) noexcept;\n"
|
||||
" std::string m;\n"
|
||||
"};\n"
|
||||
"S::S(std::string s) noexcept : m(std::move(s)) {}\n"
|
||||
"struct T {\n"
|
||||
" explicit S(std::string s) noexcept(true);\n"
|
||||
" std::string m;\n"
|
||||
"};\n"
|
||||
"T::T(std::string s) noexcept(true) : m(std::move(s)) {}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
Settings settings1 = settingsBuilder().platform(cppcheck::Platform::Type::Win64).build();
|
||||
check("using ui64 = unsigned __int64;\n"
|
||||
"ui64 Test(ui64 one, ui64 two) { return one + two; }\n",
|
||||
|
|
Loading…
Reference in New Issue