For the following code:
int main()
{
constexpr char ch[64] = "Hello";
auto res1 = ch;
constexpr auto res2 = ch;
}
The assignment of res1 is OK, but the assignment of res2 cannot compile. So this means we can get an address of a compile-time object at run time, but we cannot get the address at compile time. Can you please tell me why C++ block the compilation of that line?
Thanks a lot!