
On Thu, Apr 8, 2010 at 11:01 AM, Steven Watanabe <watanabesj@gmail.com> wrote:
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.
True. I only meant to show that there are circumstance where successful overload resolution may require a complete type. Here's another example that doesn't use function arguments. One could imagine a scenario such as template<class T> typename boost::enable_if< boost::is_pod<T>, T
::type foo();
template<class T> typename boost::disable_if< boost::is_pod<T>, int
::type foo();
Here the type of the expression foo<S>() cannot be determined if S is incomplete. Daniel Walker