Is lvalue-to-rvalue conversion is applied to the array size?

Viewed 91

Consider the following code:

int main()
{
    const int i = 10;
    int arr[i]{};
}

What I need to know is, does the lvalue-to-rvalue conversion is applied to convert lvalue i to a prvalue with value 10?

I've got this confusion because basically, [expr.const]/8 says:

An integral constant expression is an expression of integral or unscoped enumeration type, implicitly converted to a prvalue, where the converted expression is a core constant expression.

So the integral constant expression here is i, but does it's implicitly converted to prvalue?

And as pointed out in this answer:

The statement that an integral constant expression is implicitly converted to a prvalue means that the lvalue-to-rvalue conversion is applied to any expression used as an integral constant expression.

What makes me more confused is that the compiler AST doesn't shows any lvalue-to-rvalue conversion is applied.

I need to know that because I need to know whether the converted expression is core constant expression or not: If lvalue-to-rvalue is applied here, we have to find an exception, in [expr.const]/5, that permits it.

0 Answers
Related