Skip to content

Commit 4a887c5

Browse files
author
Colin Robertson
committed
Expand cases for C2280
1 parent e5cc15f commit 4a887c5

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎docs/error-messages/compiler-errors-1/compiler-error-c2280.md‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,14 @@ translation.priority.mt:
4040
'*declaration*': attempting to reference a deleted function
4141

4242
The compiler detected an attempt to reference a deleted function. This error can be caused by a call to a member function that has been explicitly marked as deleted in the source code. This error can also be caused by a call to an implicit special member function that is declared and marked as deleted by the compiler.
43-
44-
Previous versions of the compiler allowed a derived class to call member functions of indirectly-derived `private virtual` base classes. This behavior was incorrect and does not conform to the C++ standard. The compiler no longer accepts these calls and issues compiler error C2280 as a result.
43+
44+
When you see error C2280 in connection with a `unique_ptr`, it is almost certainly because you are attempting to invoke its copy constructor, which is a deleted function. By design, a `unique_ptr` cannot be copied.
45+
46+
Previous versions of the compiler allowed a derived class to call member functions of indirectly-derived `private virtual` base classes. This behavior was incorrect and does not conform to the C++ standard. The compiler now issues compiler error C2280 when such a call is made.
47+
48+
Previous versions of the compiler also generated default constructors and destructors for anonymous unions. These are now implicitly declared as deleted.
49+
50+
Previous versions of the compiler allowed implicit definition of default copy and move constructors and default copy and move assignment operators in classes that have `volatile` member variables. This behavior does not conform to the C++ standard. The compiler now considers a class that has volatile member variables to have non-trivial construction and assignment operators, which prevents automatic generation of default implementations of these operators. When such a class is a member of a union, or an anonymous union inside of a class, the copy and move constructors and copy and move assignment operators of the union, or the class containing the unonymous union, are implicitly defined as deleted. An attempt to construct or copy such a union or class without explicitly defining these operators causes compiler error C2280.
4551

4652
## Example
4753

0 commit comments

Comments
 (0)