This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-10-26


1556. Constructors and explicit conversion functions in direct initialization

Section: 12.2.2.5  [over.match.copy]     Status: CD3     Submitter: Edward Catmur     Date: 2012-09-18

[Moved to DR at the April, 2013 meeting.]

Issue 899 added wording to the second bullet of 12.2.2.5 [over.match.copy] paragraph 1 permitting use of explicit conversion functions when calling a copy constructor in a direct-initialization context. Issue 1087 addressed the problem in the earlier resolution that the phrase “copy constructor” did not include move constructors and template constructors. However, the term “copy constructor” implicitly (and correctly) restricted the constructor parameter to be the constructor's class, i.e., the class of the object being directly initialized. The new phrasing, “a constructor that takes a reference to possibly cv-qualified T as its first argument,” incorrectly assumed that T referred to the type of the object being initialized; however, that is not the case, and a converting constructor from T to the type of the object being initialized is inadvertently permitted. The wording needs a further tweak to restore the intended context.

Proposed resolution (October, 2012):

Change the second bullet of 12.2.2.5 [over.match.copy] paragraph 1 as follows:

...Assuming that “cv1 T” is the type of the object being initialized, with T a class type, the candidate functions are selected as follows: