------- Additional Comments From SWElef at post dot sk 2005-04-15 07:30 ------- I was wrong. std:10.2/2 (member name lookup) says
[snip] If the resulting set of declarations are not all from sub-objects of the same type, or the set has a nonstatic member and includes members from distinct sub-objects, there is an ambiguity and the program is ill-formed. [snip] So the deduction may not succeed. On the other hand, IIRC it is also not supposed to fail since the paragraph 14.8.2/2 that names all reasons for deduction failure does not contain anything about this specific case. The only reason that seems a little similar reads Attempting to use a type in the qualifier portion of a qualified name that names a type when that type does not contain the specified member, or if the specified member is not a type where a type is required. and in this case the named type _contains_ the specified member, it's just ambiguous. To expose the problem I wrote this new snippet: struct B1{ typedef int T; }; struct B2{ typedef int T; }; struct D : B1, B2 { }; template <typename X> typename X::T foo() { return X::T(); } int main(){ foo<D>(); } gcc reports "error: no matching function for call to `foo()'". Comeau Online says "error: "D::T" is ambiguous" which is very different (and IIRC correct). May be this PR should be resolved as INVALID and another one should be written with this snippet and a more appropriate subject. Regards, Vladimir Marko -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20812