From 691eca929efb5051bdd5e69a7b82ca5334fa87cb Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Wed, 3 Apr 2024 22:07:29 +0200 Subject: [PATCH] Add test --- test/testleakautovar.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/testleakautovar.cpp b/test/testleakautovar.cpp index f8f89534341..135dd70517d 100644 --- a/test/testleakautovar.cpp +++ b/test/testleakautovar.cpp @@ -2480,6 +2480,14 @@ class TestLeakAutoVar : public TestFixture { " std::shared_ptr a{c, [](C* x) { delete x; }};\n" "}", true); ASSERT_EQUALS("", errout_str()); + + check("struct DirDeleter {\n" // #12544 + " void operator()(DIR* d) { ::closedir(d); }\n" + "};\n" + "void openDir(DIR* dir) {\n" + " std::shared_ptr dp(dir, DirDeleter());\n" + "}\n", true); + ASSERT_EQUALS("[test.cpp:2]: (information) --check-library: Function closedir() should have configuration\n", errout_str()); // don't crash } void smartPointerRelease() { check("void f() {\n"