http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58407
Bug ID: 58407
Summary: [C++1] Should warn about deprecated implicit
generation of copy constructor/assignment
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: akrzemi1 at gmail dot com
The following program is correct in C++11, but uses a deprecated language
feature. According section D.3, paragraph 1:
"The implicit definition of a copy constructor as defaulted is deprecated if
the class has a user-declared copy assignment operator or a user-declared
destructor. The implicit definition of a copy assignment operator as defaulted
is deprecated if the class has a user-declared copy constructor or a
user-declared destructor."
G++ should emit a warning in C++11 mode.
====================
struct W {
int a;
~W() { a = 9; }
};
int main() {
W w {};
W v = w;
}