[Bug c++/17289] covariant returns and recursive templates don't mix
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Sep 2 16:24:00 GMT 2004
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-02 16:24 -------
Actually the error is correct.
Class D2 is not finished when you the template D<D2> is instantiated so we (the compiler) don't know
that D2 is a derived class of Base.
Here is the error which ICC gives:
pr17289.cc(10): error: return type is not identical to nor covariant with return type "Base *" of
overridden virtual function function "Base::clone"
F * clone() const { return 0; }
^
detected during instantiation of class "D<F> [with F=D2]" at line 13
pr17289.cc(17): error: object of abstract class type "D2" is not allowed:
pure virtual function "Base::clone" has no overrider
D2 x;
^
compilation aborted for pr17289.cc (code 2)
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17289
More information about the Gcc-bugs
mailing list