This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: BUG:cannot convert a pointer
- To: jvh at megatel dot de
- Subject: Re: BUG:cannot convert a pointer
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Tue, 3 Aug 1999 23:34:05 +0200
- CC: gcc-bugs at gcc dot gnu dot org
- References: <37A54BBA.40154C7C@megatel.de>
> 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