编译器警告 (级别 4, 错误) C4400

type”: const/volatile 不支持此类型的限定符

注解

constvolatile 限定符不适用于公共语言运行时的类型化变量。

示例

以下示例生成 C4400。

// C4400.cpp
// compile with: /clr /W4
// C4401 expected
using namespace System;
#pragma warning (disable : 4101)
int main() {
   const String^ str;   // C4400
   volatile String^ str2;   // C4400
}