c++ - 由于删除的功能调用不明确?

标签 c++

在代码中

void Fnc( long = 10 ) { }
void Fnc( ) = delete;

int main( int, char** )
{
  Fnc( );

  return 0;
}

在 Func 调用中,我的编译器提示调用不明确。帮助!我不明白为什么会这样。

最佳答案

根据 Delete Function Definition :

The definition form "=delete;" indicates that the function may not be used. However, all lookup and overload resolution occurs before the deleted definition is noted. That is, it is the definition that is deleted, not the symbol; overloads that resolve to that definition are ill-formed.

这就是为什么你会收到模棱两可的电话。

关于c++ - 由于删除的功能调用不明确?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38565358/

相关文章:

c++ - 宏是否分配内存?

c++ - 为什么这个 C++ 类不等同于这个模板?

c++ - 不稳定的声明行为 : Rational. h :25: error: expected constructor, 析构函数,或 ‘&’ token 之前的类型转换

c++ - C++ 中的不可变类和内存

c++ - LNK2038,迭代器不匹配错误,需要忽略

c++ - Phong-Alpha Material 透明度

C++ 哈希弃用警告

c++ - OpenGL 多重采样线

c++ - Oracle 7 ProC++ 预编译代码

c++ - dmPaperSize=DMPAPER_USER 和 dmPaperSize=0 一样吗?