This is the mail archive of the gcc-bugs@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]

[Bug c++/17289] covariant returns and recursive templates don't mix


------- 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


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