The snippet below was obtained from DR 2083 by Hubert Tong.
extern int globx;
int main() {
const int &x = globx;
struct A {
const int *foo() { return &x; }
} a;
return *a.foo();
}
Then the author writes:
x
satisfies the requirements for appearing in a constant expression, but applying the lvalue-to-rvalue converstion tox
does not yield a constant expression.
Why applying the lvalue-to-rvalue conversion to x
does not yield a constant-expression?