template <bool>
void f() { }
int main ()
{
constexpr long long int num = 5;
f<num & 4>(); // bitwise & is intended
return 0;
}
gcc 9 has a problem:
error: no matching function for call to 'f<(5 & 4)>()'
error: narrowing conversion of '4' from 'long long int' to 'bool' [-Wnarrowing]
clang has a problem:
error: no matching function for call to 'f'
gcc 8 and msvc compile without errors.
Who is correct? I think the error is correct but wanted to make sure.
Aucun commentaire:
Enregistrer un commentaire