V546. Member of a class is initialized by itself: 'Foo(Foo)'.


The analyzer detected a misprint in the fragment when a class member is being initialized by itself. Consider an example of a constructor:

C95(int field) : Field(Field)
{
  int Field;
  ...
}

The names of the argument and the class member here differ only in one letter. Because of that, the programmer misprinted here causing the Field member to remain uninitialized. This is the correct code:

C95(int field) : Field(field)
{
  int Field;
  ...
}

According to Common Weakness Enumeration, potential errors found by using this diagnostic are classified as CWE-665.

You can look at examples of errors detected by the V546 diagnostic.


Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++, and C#

goto PVS-Studio;
We use cookies for the analysis of events to improve our content and make user interaction more convenient. By continuing the view of our web-pages you accept the terms of using these files. You can find out more about cookie-files and privacy policy or close the notification, by clicking on the button. Learn More →
Do not show