Bug 18064 and covariant returns
Nathan Sidwell
nathan@codesourcery.com
Tue Oct 26 15:46:00 GMT 2004
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
More information about the Gcc
mailing list