Clean up copy-initialization in overloading code.
authorJason Merrill <jason@gcc.gnu.org>
Sat, 9 Dec 2000 19:03:24 +0000 (14:03 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 9 Dec 2000 19:03:24 +0000 (14:03 -0500)
        * 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

gcc/testsuite/g++.old-deja/g++.pt/auto_ptr.C

index dd5b988b31661e04e1de9b336608cb689cad2f66..c91d9c76f6f5b8085dcba7113579b3a7c477c8d6 100644 (file)
@@ -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
 }