A()
isn't a function declaration by itself, but it can be the type of a function.
For instance, suppose I declare the following function: A makeAnA();
. The type of makeAnA
is A()
: A function that takes no arguments and returns an A
.
Quoting cppreference on functions:
Each function has a type, which consists of the function's return type, the types of all parameters (after array-to-pointer and function-to-pointer transformations, see parameter list) , whether the function is noexcept
or not (since C++17), and, for non-static member functions, cv-qualification and ref-qualification (since C++11). Function types also have language linkage.
So a function that has zero parameters, returns an A
, and isn't noexcept
has the type A()
.
Therefore, it's possible to interpret A a( A() );
as a function declaration. It declares that a
accepts a single, unnamed argument of type A()
, and returns an A
as its result. Because it's possible to interpret this as a function declaration, it is required by the standard that it is so interpreted.