From 3852cc92649156b78ab8fc8690fc854e0d251385 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 19 Apr 2024 10:23:39 +0200 Subject: [PATCH] Update testclass.cpp --- test/testclass.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/testclass.cpp b/test/testclass.cpp index 6f37f0c3c92..c20eee16b1a 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -7636,6 +7636,15 @@ class TestClass : public TestFixture { " int a, b{};\n" "};"); ASSERT_EQUALS("", errout_str()); + + checkInitializerListOrder("class Foo {\n" // #3524 + "public:\n" + " Foo(int arg) : a(b), b(arg) {}\n" + " int a;\n" + " int b;\n" + "};\n"); + ASSERT_EQUALS("[test.cpp:3] -> [test.cpp:4]: (style, inconclusive) Member variable 'Foo::a' uses an uninitialized argument 'b' due to the order of declarations.\n", + errout_str()); } #define checkInitializationListUsage(code) checkInitializationListUsage_(code, __FILE__, __LINE__)