This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-11-05
[Voted into the WP at the February, 2012 meeting; moved to DR at the October, 2012 meeting.]
Although the normative wording of 11.4.8.2 [class.conv.ctor] paragraph 1 defining a converting constructor says
A constructor declared without the function-specifier explicit specifies a conversion from the types of its parameters to the type of its class.
implying that a constructor with multiple parameters can be a converting constructor, it would be helpful if the example contained such a constructor.
Proposed resolution (August, 2011):
Change the example in 11.4.8.2 [class.conv.ctor] paragraph 1 as follows:
struct X {
X(int);
X(const char*, int =0);
X(int, int);
};
void f(X arg) {
X a = 1; // a = X(1)
X b = "Jessie"; // b = X("Jessie",0)
a = 2; // a = X(2)
f(3); // f(X(3))
f({1, 2}); // f(X(1,2))
}
Change the example in 11.4.8.2 [class.conv.ctor] paragraph 2 as follows:
struct Z {
explicit Z();
explicit Z(int);
explicit Z(int, int);
};
Z a; // OK: default-initialization performed
Z a1 = 1; // error: no implicit conversion
Z a3 = Z(1); // OK: direct initialization syntax used
Z a2(1); // OK: direct initialization syntax used
Z* p = new Z(1); // OK: direct initialization syntax used
Z a4 = (Z)1; // OK: explicit cast used
Z a5 = static_cast<Z>(1); // OK: explicit cast used
Z a6 = { 3, 4 }; // error: no implicit conversion