A constant expression must yield a value of the target type , or of a type that can be implicitly converted to the target type 常数表达式必须产生具有目标类型或者可隐式转换为目标类型的类型的值。
Statement might not accept the data type you want to assign , or you might not be able to compute the value at compile time with a constant expression 语句可能不接受要赋给它的数据类型,或者在编译时可能无法使用常数表达式计算值。
Only integrals and enums that are static and const can have initializers inside a class ; the initializing expression must be a const expression 只有为static且为const的整型和枚举可以在类内有初始值设定项;初始化表达式必须是常数表达式。
By default , if an expression produces a value that is outside the range of the destination type , constant expressions cause compile - time errors , and non - constant expressions are evaluated at run - time and raise exceptions 默认情况下,如果表达式产生的值超出了目标类型的范围,则常数表达式将导致编译时错误,而非常数表达式在运行时计算并将引发异常。