Skip to content

Commit

Permalink
Add test for #3524, update release notes (#6307)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Apr 19, 2024
1 parent 3601b18 commit d7afc77
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion releasenotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ eraseIteratorOutOfBounds: warns when erase() is called on an iterator that is ou
returnByReference: warns when a large class member is returned by value from a getter function

Improved checking:
-
initializerList: warn if a member is used before it is initialized

GUI:
-
Expand Down
9 changes: 9 additions & 0 deletions test/testclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down

0 comments on commit d7afc77

Please sign in to comment.