This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/17289] covariant returns and recursive templates don't mix
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Sep 2004 16:24:15 -0000
- Subject: [Bug c++/17289] covariant returns and recursive templates don't mix
- References: <20040902161748.17289.jens.maurer@gmx.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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