This question arouse from the question "why is const in function return type, which is a const pointer, ignored?" (const pointer, not pointer to const)
int* const Foo();
is identical to
int* Foo();
I know that const in function return type, which is a fundamental type, is ignored because const applies to lvalue expressions only.
Function return type, which is a fundamental type, is non-reference function return type, and non-reference function return type is prvalue.
The following expressions are prvalue expressions:
...
However, I cannot find where a function call or an overloaded operator expression, whose return type is pointer belongs to.
Any help will be appreciated. Please correct me if I am understanding wrong.
int* p = Foo();is allowed forint* const Foo();, because it doesn't matter that Foo is returning aint* const. Theconstis irrelevant.