Consider these two demonstrative programs (sizeof( unsigned long ) == sizeof( unsigned long long )
).
The first one is
#include <iostream>
unsigned long f( unsigned long n )
requires ( not( ( sizeof( unsigned long ) == sizeof( unsigned long long ) ) ) )
{
return n;
}
int main()
{
std::cout << f( 0 ) << '\n';
}
The compiler issues an error
error: cannot call function 'long unsigned int f(long unsigned int) requires !(sizeof (long unsigned int) == sizeof (long long unsigned int))'
But when a requires expression is used in the requires clause like this
#include <iostream>
unsigned long f( unsigned long n )
requires requires { not ( sizeof( unsigned long ) == sizeof( unsigned long long ) ); }
{
return n;
}
int main()
{
std::cout << f( 0 ) << '\n';
}
The program compiles and run.
Is it a bug of the compiler or did I miss anything?