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 1
1
---
2
- description : " Learn more about: Compiler Error C2583"
3
2
title : " Compiler Error C2583"
4
- ms.date : " 11/04/2016"
3
+ description : " Learn more about: Compiler Error C2583"
4
+ ms.date : 06/06/2025
5
5
f1_keywords : ["C2583"]
6
6
helpviewer_keywords : ["C2583"]
7
- ms.assetid : b1c952dc-872c-47e4-9fc8-4dd72bcee6f9
8
7
---
9
8
# Compiler Error C2583
10
9
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 ` ** .
12
15
13
- A constructor or destructor is declared ** ` const ` ** or ** ` volatile ` ** . This is not allowed.
16
+ ## Example
14
17
15
- The following sample generates C2583:
18
+ The following example generates C2583:
16
19
17
20
``` cpp
18
21
// C2583.cpp
19
22
// compile with: /c
20
- class A {
21
- public:
22
- int i;
23
- A() const; // C2583
23
+ struct S
24
+ {
25
+ S () const {} // C2583
24
26
25
- // try the following line instead
26
- // A();
27
+ // Try the following line instead:
28
+ // S() {}
27
29
};
28
30
```
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
98
98
| Compiler error C2580| '* identifier* ': multiple versions of a defaulted special member functions are not allowed|
99
99
| [ Compiler error C2581] ( compiler-error-C2581.md ) | '* type* ': static 'operator =' function is illegal|
100
100
| [ 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|
102
102
| [ Compiler error C2584] ( compiler-error-C2584.md ) | '* class* ': direct base '* base_class2* ' is inaccessible; already a base of '* base_class1* '|
103
103
| [ Compiler error C2585] ( compiler-error-C2585.md ) | explicit conversion to '* type* ' is ambiguous|
104
104
| [ 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