Skip to content

Latest commit

 

History

History
27 lines (22 loc) · 562 Bytes

compiler-error-c3892.md

File metadata and controls

27 lines (22 loc) · 562 Bytes
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Error C3892
Compiler Error C3892
11/04/2016
C3892
C3892
83fff42c-ea48-442f-bc2e-b33a6b99d890

Compiler Error C3892

'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
}