Skip to content

Add example for C2510 #4738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/error-messages/compiler-errors-2/compiler-error-c2510.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,18 @@ ms.assetid: bf6d28db-f2f4-48f8-8f4e-7d662ed278fe
'identifier' : left of '::' must be a class/struct/union

A class, structure, or union name must appear on the left side of the scope-resolution operator (`::`) operator.

The following sample generates C2510:

```cpp
// C2510.cpp
struct S {
static const int x = 1;
};

int main() {
S s;
int num1 = s::x; // C2510
int num2 = S::x; // OK
}
```