
8 Apr
2010
8 Apr
'10
3:01 p.m.
AMDG Daniel Walker wrote:
// found in some header somewhere struct S; S foo();
What is the "declared type" of the expression "foo()"? Obviously, it is S.
It might seem so at first, but consider:
struct S; S foo(int); int foo(S);
The type of the call expression foo(x) depends on which function is statically chosen after overload resolution. Overload resolution may not succeed unless/until S is complete.
But the completeness of S only affects overload resolution when it's used as an argument. The fact that the argument of one overload is the same as the result of another is irrelevant, IMHO. In Christ, Steven Watanabe