mercredi 29 juin 2016

comparison of two auto variables

#include <iostream>

using namespace std;

int main()
{
    auto a{1};
    auto b{1};
    if (a==b)
    {
        cout << "equal";
    }
    return 0;
}

Why does the above C++ code return an error in g++ compiler with c++11 standard, instead of printing "equal" as output?

test.cpp:9:14: error: no match for ‘operator==’ (operand types are ‘std::initializer_list’ and ‘std::initializer_list’) if (a==b) ^

Aucun commentaire:

Enregistrer un commentaire