From d3c6fb4ccf04f4b1df5094585ecfdf0301e6d169 Mon Sep 17 00:00:00 2001 From: Simon Martin Date: Sat, 1 Oct 2016 21:21:07 +0200 Subject: [PATCH] Ticket #7557: Test case added since the fix for #7541 also fixed this. --- test/testunusedvar.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/testunusedvar.cpp b/test/testunusedvar.cpp index 306190f78..9fe87379e 100644 --- a/test/testunusedvar.cpp +++ b/test/testunusedvar.cpp @@ -174,6 +174,7 @@ private: TEST_CASE(usingNamespace); // #4585 TEST_CASE(lambdaFunction); // #5078 + TEST_CASE(namespaces); // #7557 } void checkStructMemberUsage(const char code[]) { @@ -4070,6 +4071,24 @@ private: "}"); TODO_ASSERT_EQUALS("[test.cpp:3]: (style) Variable 'x' is assigned a value that is never used.\n", "", errout.str()); } + + void namespaces() { // #7557 + functionVariableUsage("namespace t { namespace g {\n" + " typedef std::pair value;\n" + "} }\n" + "namespace t { namespace g {} }\n" + "namespace t {\n" + " inline double getTime() const {\n" + " iterator it=find();\n" + " double& value=it->second.values[index];\n" + " if(isnan(value)) {\n" + " value=get();\n" + " }\n" + " return value;\n" + " }\n" + "}"); + ASSERT_EQUALS("", errout.str()); + } }; REGISTER_TEST(TestUnusedVar)