【发布时间】:2016-06-29 12:36:35
【问题描述】:
#include <iostream>
using namespace std;
int main()
{
auto a{1};
auto b{1};
if (a==b)
{
cout << "equal";
}
return 0;
}
为什么上面的 C++ 代码在使用 c++11 标准的 g++ 编译器中返回错误,而不是打印“等于”作为输出?
test.cpp:9:14: error: no match for ‘operator==’ (operand types are ‘std::initializer_list’ and ‘std::initializer_list’) 如果 (a==b) ^
【问题讨论】:
-
为我工作。 ideone.com/TdnlY5
-
哪种错误?
-
使用什么编译器?什么版本?构建时使用了哪些标志?更重要的是,您会遇到什么错误?请将它们逐字复制粘贴到问题的正文中。
-
您的编译器的
auto已耗尽燃料。它需要更新
标签: c++11 initialization