Skip to content

Commit b287a44

Browse files
authored
Merge pull request #5387 from Rageking8/improve-c2574-error-reference
Improve C2574 error reference
2 parents 2410570 + 329f956 commit b287a44

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed
Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
---
2-
description: "Learn more about: Compiler Error C2574"
32
title: "Compiler Error C2574"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2574"
4+
ms.date: 06/04/2025
55
f1_keywords: ["C2574"]
66
helpviewer_keywords: ["C2574"]
7-
ms.assetid: 3e1c5c18-ee8b-4dbb-bfc0-d3b8991af71b
87
---
98
# Compiler Error C2574
109

11-
'destructor' : cannot be declared static
10+
> '*function*': cannot be declared static
11+
12+
## Remarks
1213

13-
Neither destructors nor constructors can be declared **`static`**.
14+
Neither [constructors](../../cpp/constructors-cpp.md) nor [destructors](../../cpp/destructors-cpp.md) can be declared **`static`**.
1415

15-
The following sample generates C2574:
16+
## Example
17+
18+
The following example generates C2574:
1619

1720
```cpp
1821
// C2574.cpp
1922
// compile with: /c
20-
class A {
21-
virtual static ~A(); // C2574
22-
// try the following line instead
23-
// virtual ~A();
23+
struct S
24+
{
25+
static S() {} // C2574
26+
27+
// Try the following line instead:
28+
// S() {}
2429
};
2530
```

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
description: "Learn more about: Compiler errors C2500 Through C2599"
32
title: "Compiler errors C2500 Through C2599"
4-
ms.date: "04/21/2019"
3+
description: "Learn more about: Compiler errors C2500 Through C2599"
4+
ms.date: 04/21/2019
55
f1_keywords: ["C2501", "C2508", "C2515", "C2519", "C2520", "C2522", "C2525", "C2527", "C2536", "C2538", "C2539", "C2546", "C2547", "C2559", "C2560", "C2564", "C2565", "C2576", "C2578", "C2580", "C2590", "C2591", "C2595", "C2596"]
66
helpviewer_keywords: ["C2501", "C2508", "C2515", "C2519", "C2520", "C2522", "C2525", "C2527", "C2536", "C2538", "C2539", "C2546", "C2547", "C2559", "C2560", "C2564", "C2565", "C2576", "C2578", "C2580", "C2590", "C2591", "C2595", "C2596"]
77
---
@@ -89,7 +89,7 @@ The articles in this section of the documentation explain a subset of the error
8989
|[Compiler error C2571](compiler-error-C2571.md)|'*identifier*': virtual function cannot be in union '*union*'|
9090
|[Compiler error C2572](compiler-error-C2572.md)|'*function*': redefinition of default argument: parameter *number*|
9191
|[Compiler error C2573](compiler-error-C2573.md)|'*class*': cannot delete pointers to objects of this type; the class has no non-placement overload for 'operator delete'. Use ::delete, or add 'operator delete(void*)' to the class|
92-
|[Compiler error C2574](compiler-error-C2574.md)|'*destructor*': cannot be declared static|
92+
|[Compiler error C2574](compiler-error-C2574.md)|'*function*': cannot be declared static|
9393
|[Compiler error C2575](compiler-error-C2575.md)|'*identifier*': only member functions and bases can be virtual|
9494
|Compiler error C2576|'*identifier*': cannot introduce a new virtual method as 'public'. Consider making the method non-virtual, or change the accessibility to 'internal' or 'protected private'|
9595
|[Compiler error C2577](compiler-error-C2577.md)|'*identifier*': a destructor/finalizer cannot have a return type|

0 commit comments

Comments
 (0)