Clean up copy-initialization in overloading code.
* call.c (build_user_type_conversion_1): Die if we are asked to convert to the same or a base type. (implicit_conversion): Avoid doing so. Lose reference binding code. (convert_like_real): Treat BASE_CONV and RVALUE_CONV as implicit direct-initialization. Also do direct-init part of copy-init. (build_user_type_conversion): Don't provide context to convert_like. * cvt.c (ocp_convert): build_user_type_conversion will now provide the constructor call for copy-init. From-SVN: r38159
This commit is contained in:
parent
5e818b9351
commit
b1c1090273
@ -8,9 +8,9 @@ template<typename X> struct auto_ptr {
|
||||
typedef X element_type;
|
||||
|
||||
explicit auto_ptr(X* p =0) throw() : px(p) {}
|
||||
auto_ptr(auto_ptr& r) throw() : px(r.release()) {}
|
||||
auto_ptr(auto_ptr& r) throw() : px(r.release()) {} // ERROR - candidate
|
||||
template<typename Y>
|
||||
auto_ptr(auto_ptr<Y>& r) throw() : px(r.release()) {}
|
||||
auto_ptr(auto_ptr<Y>& r) throw() : px(r.release()) {}// ERROR - candidate
|
||||
|
||||
auto_ptr& operator=(auto_ptr& r) throw() {
|
||||
reset(r.release());
|
||||
@ -29,7 +29,7 @@ template<typename X> struct auto_ptr {
|
||||
X* release() throw() { X* p=px; px=0; return p; }
|
||||
void reset(X* p=0) throw() { if (px != p) delete px, px = p; }
|
||||
|
||||
auto_ptr(auto_ptr_ref<X> r) throw() : px(r.py) {}
|
||||
auto_ptr(auto_ptr_ref<X> r) throw() : px(r.py) {} // ERROR - candidate
|
||||
template<typename Y> operator auto_ptr_ref<Y>() throw() {
|
||||
return auto_ptr_ref<Y>(release());
|
||||
}
|
||||
@ -50,5 +50,5 @@ int main() {
|
||||
auto_ptr<Derived> y(f());
|
||||
x = y;
|
||||
g(f());
|
||||
h(f());
|
||||
h(f()); // ERROR - no usable copy ctor
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user