☰
  • 首页
  • 规则分类
  • 项目介绍
search
•••

类型转换时去掉对象 const 属性并修改对象

C++-Undefined-Behavior-36
目录 › next › previous

示例:

const int ci = 0;
const_cast<int&>(ci) = 1;  // Undefined behavior

依据

ISO/IEC 14882:2003 5.2.11(7)-undefined ISO/IEC 14882:2011 5.2.11(7)-undefined

规则

ID_qualifierCastedAway
Copyright©2024 360 Security Technology Inc., Licensed under the Apache-2.0 license.