Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update c5267.md
Hopefully clarify that although it is decpreated, it is still supported.
  • Loading branch information
TylerMSFT authored Nov 14, 2023
commit 10c0b21d88ce42ff58adcbf932bd0ed033d94d2d
6 changes: 5 additions & 1 deletion docs/error-messages/compiler-warnings/c5267.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ helpviewer_keywords: ["C5267"]

## Remarks

Since C++11, when only the copy constructor or copy assignment operator is explicitly defined, implicitly generating the other is deprecated. However, to preserve backwards compatibility, the special functions are still implicitly generated.
Since C++11, the C++ Standard deprecated (but did not removed) implicitly generating the copy constructor or copy assignment operator when only or the other is explicitly defined. The MSVC compiler continues to implicitly generate the copy constructor and copy assignment assignement operator when not explicitly defined. The purpose of this warning is to help users future proof their code if the committee decides to remove this functionality, instead of just deprecate it.

The relevant sections in the C++ standard are:
- [class.copy.ctor paragraph 6](https://eel.is/c++draft/class.copy.ctor#6) which says: "If the class definition does not explicitly declare a copy constructor, a non-explicit one is declared implicitly. If the class definition declares a move constructor or move assignment operator, the implicitly declared copy constructor is defined as deleted; otherwise, it is defaulted. The latter case is deprecated if the class has a user-declared copy assignment operator or a user-declared destructor."
- [Annex D D.8]([https://eel.is/c++draft/depr.impldec](https://eel.is/c++draft/depr.impldec#1)) which says: "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. It is possible that future versions of C++ will specify that these implicit definitions are deleted"

## Example

Expand Down