Skip to content

Commit 656dcf1

Browse files
authored
Add example for C2510
1 parent c192538 commit 656dcf1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,18 @@ ms.assetid: bf6d28db-f2f4-48f8-8f4e-7d662ed278fe
1111
'identifier' : left of '::' must be a class/struct/union
1212

1313
A class, structure, or union name must appear on the left side of the scope-resolution operator (`::`) operator.
14+
15+
The following sample generates C2510:
16+
17+
```cpp
18+
// C2510.cpp
19+
struct S {
20+
static const int x = 1;
21+
};
22+
23+
int main() {
24+
S s;
25+
int num1 = s::x; // C2510
26+
int num2 = S::x; // OK
27+
}
28+
```

0 commit comments

Comments
 (0)