Consider the following code:
#include <iostream>
constexpr int fun(int const&) { return 5; }
struct T { int x; };
int main() {
std::cout << fun(T::x) << std::endl; // Line A
std::cout << requires { fun(T::x); } << std::endl; // Line B
}
If I only comment Line B, then the code cannot be compiled (as expected, since x is not static in T). But when I only comment Line A, the code compiles just fine with both Clang 11.0.0 and GCC 10.2.0 (both output 1). What it is that I am missing about requires? shouldn't it return false?