Created on 2011-07-03.00:00:00 last changed 130 months ago
[Voted into the WP at the February, 2012 meeting; moved to DR at the October, 2012 meeting.]
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
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.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-03-03 00:00:00 | admin | set | status: drwp -> cd3 |
2012-11-03 00:00:00 | admin | set | status: dr -> drwp |
2012-09-24 00:00:00 | admin | set | messages: + msg4011 |
2012-02-27 00:00:00 | admin | set | messages: + msg3826 |
2012-02-27 00:00:00 | admin | set | status: ready -> dr |
2011-07-03 00:00:00 | admin | create |