Skip to content

Update C2583 error reference #5392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
26 changes: 14 additions & 12 deletions docs/error-messages/compiler-errors-2/compiler-error-c2583.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
---
description: "Learn more about: Compiler Error C2583"
title: "Compiler Error C2583"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2583"
ms.date: 06/06/2025
f1_keywords: ["C2583"]
helpviewer_keywords: ["C2583"]
ms.assetid: b1c952dc-872c-47e4-9fc8-4dd72bcee6f9
---
# Compiler Error C2583

'identifier' : 'const/volatile' 'this' pointer is illegal for constructors/destructors
> '*identifier*': '*const/volatile*' 'this' pointer is illegal for constructors/destructors

## Remarks

A [constructor](../../cpp/constructors-cpp.md) or [destructor](../../cpp/destructors-cpp.md) can't be declared **`const`** or **`volatile`**.

A constructor or destructor is declared **`const`** or **`volatile`**. This is not allowed.
## Example

The following sample generates C2583:
The following example generates C2583:

```cpp
// C2583.cpp
// compile with: /c
class A {
public:
int i;
A() const; // C2583
struct S
{
S() const {} // C2583

// try the following line instead
// A();
// Try the following line instead:
// S() {}
};
```
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ The articles in this section of the documentation explain a subset of the error
|Compiler error C2580|'*identifier*': multiple versions of a defaulted special member functions are not allowed|
|[Compiler error C2581](compiler-error-C2581.md)|'*type*': static 'operator =' function is illegal|
|[Compiler error C2582](compiler-error-C2582.md)|'operator *operator*' function is unavailable in '*type*'|
|[Compiler error C2583](compiler-error-C2583.md)|'*identifier*': 'const/volatile' 'this' pointer is illegal for constructors/destructors|
|[Compiler error C2583](compiler-error-C2583.md)|'*identifier*': '*const/volatile*' 'this' pointer is illegal for constructors/destructors|
|[Compiler error C2584](compiler-error-C2584.md)|'*class*': direct base '*base_class2*' is inaccessible; already a base of '*base_class1*'|
|[Compiler error C2585](compiler-error-C2585.md)|explicit conversion to '*type*' is ambiguous|
|[Compiler error C2586](compiler-error-C2586.md)|incorrect user-defined conversion syntax: illegal indirections|
Expand Down