Skip to content

Fix #14546 FN uninitMemberVar (in-class initializers but no constructor)#8274

Open
chrchr-github wants to merge 12 commits intodanmar:mainfrom
chrchr-github:chr_14546
Open

Fix #14546 FN uninitMemberVar (in-class initializers but no constructor)#8274
chrchr-github wants to merge 12 commits intodanmar:mainfrom
chrchr-github:chr_14546

Conversation

@chrchr-github
Copy link
Copy Markdown
Collaborator

No description provided.

@sonarqubecloud
Copy link
Copy Markdown

chrchr-github and others added 3 commits April 10, 2026 08:30
Co-authored-by: Daniel Marjamäki <daniel.marjamaki@gmail.com>
std::string filename;
int lineNumber;
int column;
int lineNumber{};
Copy link
Copy Markdown
Owner

@danmar danmar Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm.. this struct is only accessible in Tokenizer methods and if I look manually I can quite easily see that lineNumber is always initialized when this struct is created.

A user can see this as noise. We could be less pedantic here.

If you feel this is wanted even though we can see the code is safe, well I wonder if a tweaked ID can be used for this more noisy warning.

@danmar
Copy link
Copy Markdown
Owner

danmar commented Apr 10, 2026

The idea of uninitMemberVar was to warn if a constructor fails to initialize members.

I have the feeling that this is doing something a bit different. A separate warning message and id could be a good idea that more specifically say that some members are initialized and others are not in a no-constructor struct.

and maybe uninitMemberVar should be specified better also so it's specified clearly that it checks constructors.

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants