Skip to content

Commit b56fc1f

Browse files
authored
Merge pull request #5392 from Rageking8/update-c2583-error-reference
Update C2583 error reference
2 parents 6a320f6 + d6685b1 commit b56fc1f

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed
Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
---
2-
description: "Learn more about: Compiler Error C2583"
32
title: "Compiler Error C2583"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2583"
4+
ms.date: 06/06/2025
55
f1_keywords: ["C2583"]
66
helpviewer_keywords: ["C2583"]
7-
ms.assetid: b1c952dc-872c-47e4-9fc8-4dd72bcee6f9
87
---
98
# Compiler Error C2583
109

11-
'identifier' : 'const/volatile' 'this' pointer is illegal for constructors/destructors
10+
> '*identifier*': '*const/volatile*' 'this' pointer is illegal for constructors/destructors
11+
12+
## Remarks
13+
14+
A [constructor](../../cpp/constructors-cpp.md) or [destructor](../../cpp/destructors-cpp.md) can't be declared **`const`** or **`volatile`**.
1215

13-
A constructor or destructor is declared **`const`** or **`volatile`**. This is not allowed.
16+
## Example
1417

15-
The following sample generates C2583:
18+
The following example generates C2583:
1619

1720
```cpp
1821
// C2583.cpp
1922
// compile with: /c
20-
class A {
21-
public:
22-
int i;
23-
A() const; // C2583
23+
struct S
24+
{
25+
S() const {} // C2583
2426

25-
// try the following line instead
26-
// A();
27+
// Try the following line instead:
28+
// S() {}
2729
};
2830
```

docs/error-messages/compiler-errors-2/compiler-errors-c2500-through-c2599.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The articles in this section of the documentation explain a subset of the error
9898
|Compiler error C2580|'*identifier*': multiple versions of a defaulted special member functions are not allowed|
9999
|[Compiler error C2581](compiler-error-C2581.md)|'*type*': static 'operator =' function is illegal|
100100
|[Compiler error C2582](compiler-error-C2582.md)|'operator *operator*' function is unavailable in '*type*'|
101-
|[Compiler error C2583](compiler-error-C2583.md)|'*identifier*': 'const/volatile' 'this' pointer is illegal for constructors/destructors|
101+
|[Compiler error C2583](compiler-error-C2583.md)|'*identifier*': '*const/volatile*' 'this' pointer is illegal for constructors/destructors|
102102
|[Compiler error C2584](compiler-error-C2584.md)|'*class*': direct base '*base_class2*' is inaccessible; already a base of '*base_class1*'|
103103
|[Compiler error C2585](compiler-error-C2585.md)|explicit conversion to '*type*' is ambiguous|
104104
|[Compiler error C2586](compiler-error-C2586.md)|incorrect user-defined conversion syntax: illegal indirections|

0 commit comments

Comments
 (0)