Suppose I have function declarations like these:
static const int R = 0;
static const int I = 0;
void f(const int& r = R);
void g(int i = I);
Per [dcl.fct.default]/1:
If an initializer-clause is specified in a parameter-declaration this initializer-clause is used as a default argument [..]
and per the grammar constructs, an initializer can comprise an initializer-clause. Right?
So I concluded that R is an initializer for the parameter r, and I is also an initializer for the parameter i.
Now per [const.expr]/2:
A variable or temporary object
ois constant-initialized if
- (2.1) either it has an initializer [..] and
- (2.2) the full-expression of its initialization is a constant expression [..]
So both parameters have an initializer and also the full-expression of their initializations is a constant expression.
So, Are both parameters r and i considered constant-initialized?