I came across this which states:
Not a bug,
auto(x);
is interpreted asauto x;
. Use+auto(x);
if you want that to be an expression.
The above seems to imply that since auto(x);
is a declaration(equivalent to auto x;
) it should be rejected since we're using auto
and don't have an initializer.
While this states:
Yes this changed in C++23 so auto(X) creates an rvalue of the decayed type of x.
The above quoted statements seems to be contradicting each other. So my question is what does the C++23 standard say about this? I mean is auto(x);
a declaration or a explicit type cast.