Examples of errors detected by the V766 diagnostic.


V766. An item with the same key has already been added.


Chromium

V766 An item with the same key '"colorSectionBorder"' has already been added. ntp_resource_cache.cc 581


void NTPResourceCache::CreateNewTabCSS()
{
  ....
  // Colors.
  substitutions["colorBackground"] =
    SkColorToRGBAString(color_background);
  substitutions["backgroundBarDetached"] =
    GetNewTabBackgroundCSS(tp, false);
  substitutions["backgroundBarAttached"] =
    GetNewTabBackgroundCSS(tp, true);
  substitutions["backgroundTiling"] =
    GetNewTabBackgroundTilingCSS(tp);
  substitutions["colorTextRgba"] =
    SkColorToRGBAString(color_text);
  substitutions["colorSectionBorder"] =
      SkColorToRGBAString(color_section_border); // <=
  substitutions["colorTextLight"] =
    SkColorToRGBAString(color_text_light);
  substitutions["colorSectionBorder"] =
      SkColorToRGBComponents(color_section_border); // <=
  substitutions["colorText"] =
    SkColorToRGBComponents(color_text);
  ....
}

MuseScore

V766 An item with the same key '"mrcs"' has already been added. importgtp-gp6.cpp 100


const static std::map<QString, QString> instrumentMapping = {
  ....
  {"e-piano-gs", "electric-piano"},
  {"e-piano-ss", "electric-piano"},
  {"hrpch-gs", "harpsichord"},
  {"hrpch-ss", "harpsichord"},
  {"mrcs", "maracas"},                // <=
  {"mrcs", "oboe"},                   // <=
  {"mrcs", "oboe"},                   // <= using of Copy-Paste
  ....
};


Do you make errors in the code?

Check your code
with PVS-Studio

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

goto PVS-Studio;