编译器警告(等级 4)C5266
返回类型的“const”限定符不起作用
C++ 标准指定忽略函数返回类型的顶级 const(或 volatile)限定。
默认情况下,此警告处于关闭状态。
Visual Studio 17.6 中引入了此警告
示例
以下示例产生了 C5266:
// compile with: /W4 /c
#pragma warning(default : 5266) // enable warning C5266 because it's off by default (or compile with /w45266)
const int f() // warning C5266: 'const' qualifier on return type has no effect
{
return 13;
}
另请参阅
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈