You can't call an expression whose value is IO-dependent in a compile-time context, obviously.
The tweet seems to imply that if you can call your functions at compile time, they will not present UB at runtime either. I am trying to point out that that is not the case at all.
The example program is calling foo(y), where the value of y is read from standard input. You suggested to evaluate that expression at compile time, which is not possible. How is this unrelated to the thread?
Yes, but that error would simply complain that a variable that doesn't have a compile time known value is been used in a compile time context.
Conversely, the origin of the thread implies that if a function has been successfully called with some argument from a static_assert, it will not have UB at runtime even if called with some other arguments. This subthread was showing that this is not the case, and that you can't test all uses of a function using static_assert to guarantee that it will not exhibit UB.
In case it's not clear, this piece of code will also fail to compile, even though it exhibits no UB:
constexpr int foo(int y) {
return y;
}
int y;
std::cin>>y;
static_assert(foo(y));
The tweet seems to imply that if you can call your functions at compile time, they will not present UB at runtime either. I am trying to point out that that is not the case at all.