diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index efe79a49e56..f9078bead4b 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -756,7 +756,12 @@ static void valueFlowTypeTraits(TokenList& tokenlist, const Settings& settings) continue; if (eval.count(traitName) == 0) continue; - ValueFlow::Value value = eval[traitName](evaluateTemplateArgs(templateTok->next())); + auto args = evaluateTemplateArgs(templateTok->next()); + if (std::any_of(args.begin(), args.end(), [](const std::vector& arg) { + return arg.empty(); + })) + continue; + ValueFlow::Value value = eval[traitName](std::move(args)); if (value.isUninitValue()) continue; value.setKnown(); diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index ed942906efc..82a91d14a30 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -7894,6 +7894,11 @@ class TestValueFlow : public TestFixture { " } while (true);\n" "}\n"; (void)valueOfTok(code, "0"); + + code = "bool f() {\n" + " return (!std::is_reference::value);\n" + "}\n"; + (void)valueOfTok(code, "0"); } void valueFlowHang() {