编译器错误 C3891
“var”:literal 数据成员不能用作左值
literal 变量是常数,在声明中初始化后,无法更改其值。
以下示例生成 C3891:
// C3891.cpp
// compile with: /clr
ref struct Y1 {
literal int staticConst = 9;
};
int main() {
Y1::staticConst = 0; // C3891
}
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈