Skip to content

Commit 7e6699c

Browse files
Merge pull request MicrosoftDocs#2389 from corob-msft/cr-1547
Reformat and clarify per issue 1547
2 parents 8112d25 + f7636ba commit 7e6699c

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

docs/error-messages/compiler-errors-2/compiler-error-c2864.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
---
22
title: "Compiler Error C2864"
3-
ms.date: "11/04/2016"
3+
ms.date: 10/04/2019
44
f1_keywords: ["C2864"]
55
helpviewer_keywords: ["C2864"]
66
ms.assetid: d0ca2ad9-90a6-4aef-8511-98a3b414c102
77
---
88
# Compiler Error C2864
99

10-
'variable' : a static data member with an in-class initializer must have non-volatile const integral type
10+
> '*member-name*' : a static data member with an in-class initializer must have non-volatile const integral type
1111
12-
To initialize a `static` data member that is defined as `volatile`, non-`const`, or not an integral type, use a member-definition statement. They cannot be initialized in a declaration.
12+
## Remarks
13+
14+
To initialize a `static` data member that's defined as `volatile`, non-`const`, or not an integral type, use a member-definition statement. They can't be initialized in a declaration.
15+
16+
## Example
1317

1418
This sample generates C2864:
1519

16-
```
20+
```cpp
1721
// C2864.cpp
1822
// compile with: /c
1923
class B {
@@ -22,14 +26,14 @@ private:
2226
static int b = 3; // C2864
2327
volatile static int c = 3; // C2864
2428
volatile static const int d = 3; // C2864
25-
const static long long e = 3; // OK
29+
static const long long e = 3; // OK
2630
static const double f = 3.33; // C2864
2731
};
2832
```
2933
3034
This sample shows how to fix C2864:
3135
32-
```
36+
```cpp
3337
// C2864b.cpp
3438
// compile with: /c
3539
class C {
@@ -48,4 +52,4 @@ int C::b = 3;
4852
volatile int C::c = 3;
4953
volatile const int C::d = 3;
5054
const double C::f = 3.33;
51-
```
55+
```

0 commit comments

Comments
 (0)