Ya you are right.
But in the above code, you are initializing "const int x" at the time of declaration. That's why you are getting a result of 50.
I think you what you need is,
just do this.
1. declare the const int x; and then try to initialize,
2. x = get_const(); //here you will get a compilation error saying that assignment of read-only variable ‘x’.
const int x;
x = get_const();