Rectangle s(origin());
is a vexing parse too. It declares a function s
which returns rectangle
, and takes as argument pointer to function returning origin
. Not sure what you meant by “works fine”.
rectangle w( origin(), extents() );
declares a function w
returning rectangle
and taking arguments: pointer to function returning origin
, and pointer to function returning extents
.
For more detail see this question or browse the other questions under the most-vexing-parse tag.