From 194a1be2c603b4d7d6dbf8b4283f0accd825b463 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Sat, 20 Nov 2021 08:52:27 +0100 Subject: [PATCH] Add test for #4792 (#3573) --- test/testconstructors.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/testconstructors.cpp b/test/testconstructors.cpp index 7b10120ed..1ba8c3ba8 100644 --- a/test/testconstructors.cpp +++ b/test/testconstructors.cpp @@ -1986,6 +1986,23 @@ private: "}"); ASSERT_EQUALS("[test.cpp:11]: (warning) Member variable 'Foo::mMember' is not initialized in the constructor.\n", errout.str()); + // constructor outside namespace with using, #4792 + check("namespace Output\n" + "{\n" + " class Foo\n" + " {\n" + " public:\n" + " Foo();\n" + " private:\n" + " bool mMember;\n" + " };\n" + "}\n" + "using namespace Output;" + "Foo::Foo()\n" + "{\n" + "}"); + ASSERT_EQUALS("[test.cpp:11]: (warning) Member variable 'Foo::mMember' is not initialized in the constructor.\n", errout.str()); + // constructor in separate namespace check("namespace Output\n" "{\n"