int* get(){return nullptr;}
int main()
{
if(auto p = get(); (*p) != 1231231233)
{
std::cout << "NO"; // not printed
}
else
{
std::cout << "we should be here" << std::endl;;
}
}
Why is here not NO printed, because according to the standard, the init-statement is not checked to true and the access to *p should be UB and we should result in true ?. I am puzzled: LIVE
Aucun commentaire:
Enregistrer un commentaire