Title
Additional applications of issue 899
Status
c++11
Section
12.2.2.5 [over.match.copy]
Submitter
Jason Merrill

Created on 2010-06-25.00:00:00 last changed 122 months ago

Messages

Date: 2010-11-15.00:00:00

[Voted into the WP at the November, 2010 meeting.]

Date: 2010-08-15.00:00:00

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
    }
Date: 2010-06-25.00:00:00

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:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetstatus: dr -> fdis
2010-11-29 00:00:00adminsetmessages: + msg3192
2010-11-29 00:00:00adminsetstatus: ready -> dr
2010-08-23 00:00:00adminsetmessages: + msg2799
2010-06-25 00:00:00admincreate