This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: gcc-4.0-virtual function return type


> I read the current changes of gcc-4.0. There is the following in the C++ part:
>
> G++ has an undocumented extension to virtual function covariance rules that 
> allowed the overrider to return a type that was implicitly convertable to the 
> overridden function's return type. For instance a function returning void * 
> could be overridden by a function returning T *. This is now deprecated and 
> will be removed in a future release.
>
> -----------
>
> Why are you going to throw away such good features like this one? This feature 
> is something greatly extending the object oriented programming. - A method of 
> a derived class can return a more specialised type as its parent- thats what 
> oop is all about!: Specialisation of a base class. (This greatly extends 
> polymorphism- very, very usefull!) 

Do you really rely on this particular bug, or do you fear that
covariant return types will be removed altogether?

Covariant return types will not be removed from the G++ language, it's
only the implementation that will be fixed.  Currently, the check of
the return type is too lax.  Future version will tighten it, but not
the point that covariant return types are no longer possible.


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