Consider the following program:
#include
struct A {};
int main(int argc, char** argv) {
A a(std::fstream(argv[1]));
}
I think it's being parsed as
A a(std::fstream argv[1]);
i.e. a function that takes in an array of 1 std::fstream
, where the extra parentheses are redundant.
Of course, in reality, that array parameter decays to a pointer, so what you end up with semantically is:
A a(std::fstream* argv);
The parens are superfluous. All of the following are the declarations:
T a;
T (a);
T ((a));
T (((a))));
so are these:
T a[1];
T (a[1]);
T ((a[1]));
T (((a[1]))));
So is this:
A a(std::fstream(argv[1]));
which is same as:
A a(std::fstream argv[1]);
which is same as:
A a(std::fstream *argv);
Hope that helps.