File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
docs/error-messages/compiler-errors-1 Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 11---
2- description : " Learn more about: Compiler Error C2166"
32title : " Compiler Error C2166"
4- ms.date : " 11/04/2016"
3+ description : " Learn more about: Compiler Error C2166"
4+ ms.date : 06/29/2025
55f1_keywords : ["C2166"]
66helpviewer_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
1314Code 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```
You can’t perform that action at this time.
0 commit comments