This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/61587] Line number of code that triggers "use of deleted function" error is absent from error message
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 24 Jun 2014 08:21:33 +0000
- Subject: [Bug c++/61587] Line number of code that triggers "use of deleted function" error is absent from error message
- Auto-submitted: auto-generated
- References: <bug-61587-4 at http dot gcc dot gnu dot org/bugzilla/>
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.