Skip to content

Commit d9ff8a4

Browse files
autoantwortclaude
andcommitted
Add tests for const pointer and static members
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 325020d commit d9ff8a4

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎test/testconstructors.cpp‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,21 @@ class TestConstructors : public TestFixture {
818818
"};\n");
819819
ASSERT_EQUALS("[test.cpp:3:16]: (warning) Member variable 'S::d' has no initializer. [uninitMemberVarNoCtor]\n", errout_str());
820820

821+
check("struct S {\n"
822+
" int a = 0;\n"
823+
" int* const p;\n"
824+
" int k;\n"
825+
"};\n");
826+
ASSERT_EQUALS("", errout_str());
827+
828+
check("struct S {\n" // static members don't affect the default constructor
829+
" int a = 0;\n"
830+
" static const int N;\n"
831+
" static int& r;\n"
832+
" int k;\n"
833+
"};\n");
834+
ASSERT_EQUALS("[test.cpp:5:9]: (warning) Member variable 'S::k' has no initializer. [uninitMemberVarNoCtor]\n", errout_str());
835+
821836
check("struct S {\n"
822837
" std::string a;\n"
823838
" const std::string s;\n"

0 commit comments

Comments
 (0)