On 07/22/2013 09:22 PM, Jason Merrill wrote:
OK.
Thanks, applied.
(*) Note that, depending on how it's called, the predicate can
currently produce errors anyway, for example because it calls
complete_type. This may or may not be all there is to c++/57942.
It looks like lookup_base seems to deliberately avoid trying to
complete the base, so the call to complete_type is coming from elsewhere.
I see, indeed the comment in lookup_base:
/* If BASE is incomplete, it can't be a base of T--and instantiating it
might cause an error. */
is very clear. Now, I tell you briefly what is going on:
standard_conversion calls ptr_reasonably_similar, which, in turn calls
comptypes. The latter, via structural_comptypes, does:
if ((strict & COMPARE_BASE) && DERIVED_FROM_P (t1, t2))
break;
else if ((strict & COMPARE_DERIVED) && DERIVED_FROM_P (t2, t1))
break;
you see, DERIVED_FROM_P, thus lookup_base, handles *both* the pair
(base, derived) and the swapped pair (derived, base), thus for sure in
one case the above comment / code doesn't help, because it protects vs
the instantiation of the base argument not vs the instantiation of the t
argument... bummer. I guess fixing the issue must be rather doable but
at the moment I'm not clear about where to act...
Thanks!
Paolo.