mardi 24 mai 2016

Can a variable be redeclared as auto that deduced to the same type?

Is the following allowed by the standard?

#include <iostream>

extern int a;
auto a = 3;

int main(int, char**)
{
    std::cout << a << std::endl;
    return 0;
}

clang accepts the code. g++ complains for conflicting declaration.

Aucun commentaire:

Enregistrer un commentaire