I was going through this article
and there is a statement in item 3 saying
// C++98
rectangle w( origin(), extents() ); // oops, vexing parse
how is the above a most vexing parse. If I did something like this
struct origin
{
};
struct Rectangle
{
Rectangle(const origin& s)
{
}
};
The statement
Rectangle s(origin());
works fine and does not resemble a vexing parse. Why did the author say that its a vexing parse. Is that a typo or am I missing something ?
Rectangle s(origin());
does not resemble a vexing parse? It is the canonical example of the most vexing parse. What do you think the most vexing parse is, if not that? – Hyalines
and see what happens. – Thunderyfoo a();
would give an error while compiling and its a form of most vexing parse.So from what I get is a that a statement could resemble a vexing parse and at the same time compile without any issues. A vexing parse from what I understand is a statement that might resemble a function.<Return type> functionName (parameters..)
– Roper