From 7e600c33e55c55e9a0ba8274b2b745b3c5b3b3c8 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 25 Nov 2025 12:47:08 +0100 Subject: [PATCH 1/2] Update checkclass.cpp --- lib/checkclass.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index ec6c00b8dc4..44a6207d749 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -1084,13 +1084,11 @@ void CheckClass::initializeVarList(const Function &func, std::list* pMap = nullptr;\n" "};\n"); ASSERT_EQUALS("", errout_str()); + + check("struct S {\n" // #6294 + " S() : r(new int) {\n" + " *p = 0;\n" + " *(q) = 1;\n" + " *r = 2;\n" + " }\n" + " int *p, *q, *r;\n" + "};\n"); + ASSERT_EQUALS("[test.cpp:2:5]: (warning) Member variable 'S::p' is not initialized in the constructor. [uninitMemberVar]\n" + "[test.cpp:2:5]: (warning) Member variable 'S::q' is not initialized in the constructor. [uninitMemberVar]\n", + errout_str()); } void uninitConstVar() {