https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61587

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-06-24
     Ever confirmed|0                           |1

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:

template<typename T>
struct vector {
  T t;
  vector(const vector& v) : t(v.t) { }
  vector() { }
};

struct U_ptr {
  U_ptr() = default;
  U_ptr(U_ptr&&) = default;
};

class A {
  vector<U_ptr> v;
};

void f() {
    A a1;
    A a2(a1); // the error is here
}

Compiling with -std=c++11 gives:

r.cc: In instantiation of ‘vector<T>::vector(const vector<T>&) [with T =
U_ptr]’:
r.cc:13:7:   required from here
r.cc:4:34: error: use of deleted function ‘constexpr U_ptr::U_ptr(const
U_ptr&)’
   vector(const vector& v) : t(v.t) { }
                                  ^
r.cc:8:8: note: ‘constexpr U_ptr::U_ptr(const U_ptr&)’ is implicitly declared
as deleted because ‘U_ptr’ declares a move constructor or move assignment
operator
 struct U_ptr {
        ^


Not a regression.

Clang gives very similar output, without pointing to the invalid copy
construction.

EDG says the error happens due to the implicit generation of A's copy
constructor at line 19.

Reply via email to