Created on 2010-06-25.00:00:00 last changed 130 months ago
[Voted into the WP at the November, 2010 meeting.]
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
}
The resolution of issue 899 needs to be extended to cover move constructors and template constructors as well.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-03-03 00:00:00 | admin | set | status: fdis -> c++11 |
2011-04-10 00:00:00 | admin | set | status: dr -> fdis |
2010-11-29 00:00:00 | admin | set | messages: + msg3192 |
2010-11-29 00:00:00 | admin | set | status: ready -> dr |
2010-08-23 00:00:00 | admin | set | messages: + msg2799 |
2010-06-25 00:00:00 | admin | create |