This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc-4.0-virtual function return type
Nathan Sidwell wrote:
> 1) It led to user confusion about what was valid/invalid (bug report)
Well yes, but that's just a consequence of 2)!
> 2) It is not documented - no user would know for sure what it was
> supposed to do
That of course is bad, in fact it's a bug. But on its own it argues
for supplying the missing documentation, not for removing the feature.
3) It is (possibly) incomplete in that say, an 'int' returning function
cannot be overridden by a 'short' returning function, which some might
say is more specialized.
This seems a very weak (almost bogus) counter argument. Yes, some might
say that, but then some might say almost anything. It is obvious that
this is entirely unrelated to me to the feature being discussed. In any
case, fixing 2) by documenting the feature will cure this problem.
4) It does not work for Ts that have non-trival destructors -- either
the destructor is not called, or the caller of the virtual function must
know which instance will actually be called so the dynamic type is
known (this rather misses the point of virtual function calls)[%].
That's more serious to me. I think that unless this can be addressed
cleanly, it's a strong argument, though it still seems this is a useful
language extension.