About the full-expression, there are some quotes in the standard, they are:
A full-expression is
- an unevaluated operand,
- a constant-expression,
- an init-declarator or a mem-initializer, including the constituent expressions of the initializer,
- an invocation of a destructor generated at the end of the lifetime of an object other than a temporary object, or
- an expression that is not a subexpression of another expression and that is not otherwise part of a full-expression.
For an initializer, performing the initialization of the entity (including evaluating default member initializers of an aggregate) is also considered part of the full-expression.
Now, please consider the below code:
struct A{
constexpr A(int){
}
};
int main(){
constexpr A t = 0; //#1
}
A constexpr specifier used in an object declaration declares the object as const. Such an object shall have literal type and shall be initialized. In any constexpr variable declaration, the full-expression of the initialization shall be a constant expression.
Look at #1, it's a declaration, according to the standard, within this declaration, the init-declarator is a full-expression, So what's the full-expression of initialization, if it's A::A(0) (comprise the conversion), it would be contradict with the bullet point 5 of the full-expression, that's an expression that is not otherwise part of a full-expression. Obviously, the A::A(0) is part of the full-expression init-declarator, Hence A::A(0) shouldn't be a full-expression.
If the full-expression of initialization is referred to init-declarator, Due to a init-declarator is not a expression, how does a init-declarator could be a constant-expression? I'm very confused here, If my understanding is wrong, what actually the full-expression of initialization is?