I have two variables outside of any functions (having the fixed address):
constexpr int j = 1;
const int k = 2;
Then I get their address in main:
int main(){
   constexpr int *p1 = &j; // ok
   constexpr int *p2 = &k; //error: incompatible pointer types of `int*` and const int*
   return 0;
}
I know that constexpr means it can be determined at compile time, and also implies const .
I think if j is a const, p1 should be:
constexpr const int *p1 = &j;
And constexpr const int *p2 = &k works well as expected.
Then, why is constexpr int *p2 = &k wrong while constexpr const int *p2 = &k is ok ?
