This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-12-19
[Voted into the WP at the November, 2010 meeting.]
The resolution of issue 899 needs to be extended to cover move constructors and template constructors as well.
Proposed resolution (August, 2010):
When the type of the initializer expression is a class type
“cv S”, the non-explicit conversion
functions of S and its base classes are considered. When
initializing a temporary to be bound to the first parameter of a
copy constructor (11.4.5.3 [class.copy.ctor])
that takes a reference to possibly cv-qualified T as its
first argument, called with a single argument in the context of
direct-initialization, explicit conversion functions are also
considered. Those that are not hidden within S and yield a
type whose cv-unqualified version is the same type as T or is
a derived class thereof are candidate functions. Conversion functions
that return “reference to X” return lvalues or
xvalues, depending on the type of reference, of type X and
are therefore considered to yield X for this process of
selecting candidate functions.
For example
struct C {
template <class T = int> C(C&, T = 0);
};
struct A {
explicit operator C&() const;
};
int main() {
A a;
C c (a); // should use template constructor
}