Skip to content

Commit fa6d24e

Browse files
Merge pull request #5473 from Rageking8/update-c2166-error-reference
Update C2166 error reference
2 parents 28e3e80 + 8052c85 commit fa6d24e

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed
Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
---
2-
description: "Learn more about: Compiler Error C2166"
32
title: "Compiler Error C2166"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2166"
4+
ms.date: 06/29/2025
55
f1_keywords: ["C2166"]
66
helpviewer_keywords: ["C2166"]
7-
ms.assetid: 12789c3a-cc76-48bb-ae2e-64283e0964ed
87
---
98
# Compiler Error C2166
109

11-
l-value specifies const object
10+
> l-value specifies const object
11+
12+
## Remarks
1213

1314
Code attempts to modify an item declared **`const`**.
1415

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

1720
```cpp
1821
// C2166.cpp
19-
int f();
20-
int main() {
21-
( (const int&) 1 ) = 5; // C2166
22+
int main()
23+
{
24+
((const int&)1) = 5; // C2166
2225
}
2326
```

0 commit comments

Comments
 (0)