Export (0) Print
Expand All
Expand Minimize
0 out of 3 rated this helpful - Rate this topic

Compiler Error C3892

Error Message

'var' : you cannot assign to a variable that is const

A const variable cannot be changed after it is declared and initialized.

The following sample generates C3892:

// C3892.cpp
// compile with: /clr
ref struct Y1 {
   static const int staticConst = 9;
};

int main() {
   Y1::staticConst = 0;   // C3892
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.