vendredi 27 mars 2015

Why does endl(std::cout) compile


Surprisingly the below code compiles and runs without error on a variety of compilers and versions.



#include <iostream>

int main() {
endl(std::cout);
return 0;
}


Ideone link


How does it compile? I am sure there is no endl in global scope because a code like



std::cout << endl;


would fail unless using is used or else you need std::endl.




Aucun commentaire:

Enregistrer un commentaire