File tree Expand file tree Collapse file tree 2 files changed +15
-13
lines changed
docs/error-messages/compiler-errors-2 Expand file tree Collapse file tree 2 files changed +15
-13
lines changed Original file line number Diff line number Diff line change 11---
2- description : " Learn more about: Compiler Error C2583"
32title : " Compiler Error C2583"
4- ms.date : " 11/04/2016"
3+ description : " Learn more about: Compiler Error C2583"
4+ ms.date : 06/06/2025
55f1_keywords : ["C2583"]
66helpviewer_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```
Original file line number Diff line number Diff 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|
You can’t perform that action at this time.
0 commit comments