This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: BUG:cannot convert a pointer


> From my point of view this one is a bug: lines 16 and 17 of
> my sample should mean the same. 

From the view of the C++ standard, your code is ill-formed. According
to 3.4.3.1, name lookup of D::f finds {A::f(void)}. So, according to
9.3.1, the whole function call (being inside a class) becomes

  (*this).A::f(void)

This is ambiguous. Overload resolution is invoked, and still can't
resolve it, so it remains ambiguous.

> Not using -pedantic 'solves' the problem.

Yes, this is an extension in g++: It takes the qualifier on the method
name into account to select a subobject. The comment says

  /* Convert 'this' to the specified type to disambiguate conversion
     to the function's context.  Apparently Standard C++ says that we
     shouldn't do this.  */

With -pedantic, this extension is disabled.

Hope this helps,
Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]