Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFCCCC
langcpp
#include <iostream>


struct Widget {
  explicit Widget(int I) { std::cout << "Widget constructed" << std::endl; }
};


struct Gadget {
  explicit Gadget(Widget wid) { std::cout << "Gadget constructed" << std::endl; }
};


void f() {
  int i = 3;
  Gadget g(Widget(i));
  std::cout << i << std::endl;
}

...

Tool

Version

Checker

Description

 PRQA QA-C++

 

Include Page
PRQA QA-C++_vV
PRQA QA-C++_vV

2510

 
Clang
Include Page
Clang_V
Clang_V
-Wvexing-parse 

Related Vulnerabilities

Search for other vulnerabilities resulting from the violation of this rule on the CERT website.

...

[ISO/IEC 14882-2014]6.8, "Ambiguity resolution"
8.2, "Ambiguity resolution"
[Meyers 01]Item 6, "Be alert for C++'s most vexing parse"