http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53733
Bug #: 53733
Summary: [C++11][DR 1402] Move constructor/assignment operator
too often deleted
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
This is a place-holder entry as a reminder to fix
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1402
The following example should be well-formed when compiled in C++11 mode, but is
currently not (tested with gcc 4.8.0 20120610 (experimental)):
template<typename T>
struct wrap
{
wrap() = default;
wrap(wrap&&) = default; // Line 5
wrap(const wrap&) = default;
T t;
};
struct S {
S() = default;
S(const S&){}
S(S&&) = default;
};
typedef wrap<const S> W;
W get() { return W(); } // Line 19
int main() {}
"In function 'W get()':|
19|error: use of deleted function 'wrap<T>::wrap(wrap<T>&&) [with T = const
S]'|
5|note: 'wrap<T>::wrap(wrap<T>&&) [with T = const S]' is implicitly deleted
because the default definition would be ill-formed:|
5|error: non-static data member 'wrap<const S>::t' does not have a move
constructor or trivial copy constructor|"