lundi 20 avril 2015

Is std::abs(0u) ill-formed?

Given the following program:

#include <cmath>

int main()
{
    std::abs(0u) ;
}

gcc and clang disagree on whether this is ill-formed or not, using gcc it builds without error or warning (see it live), while using clang it generates the following error (see it live):

error: call to 'abs' is ambiguous
std::abs(0u) ;
^~~~~~~~

Which result is correct? Should abs(0u) be ambiguous or not?

Aucun commentaire:

Enregistrer un commentaire