This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Bug 18064 and covariant returns
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: gcc <gcc at gcc dot gnu dot org>
- Cc: Mark Mitchell <mark at codesourcery dot com>, Jason Merrill <jason at redhat dot com>
- Date: Tue, 26 Oct 2004 11:25:45 +0100
- Subject: Bug 18064 and covariant returns
- Organization: Codesourcery LLC
We apparently have a gnu extension that allows a virtual function
returning void * to be overridden by one returning T *, provided
T is not a class type
search.c:
else if (!pedantic
&& can_convert (TREE_TYPE (base_type), TREE_TYPE (over_type)))
/* GNU extension, allow trivial pointer conversions such as
converting to void *, or qualification conversion. */
{
/* can_convert will permit user defined conversion from a
(reference to) class type. We must reject them. */
over_return = non_reference (TREE_TYPE (over_type));
if (CLASS_TYPE_P (over_return))
fail = 2;
This is not documented in extend.texi.
Do we want to keep the extension?
My preference would be to deprecate and remove it (it's easier to
remove than document), but I'm not passionate about that.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk