VC7.1 covariant return bug? 
Author Message
 VC7.1 covariant return bug?

I'm getting an error in VC7.1 that I can't figure out.  
This didn't work in previous compiler versions but I
thought covariant returns were working in 7.1.  Is there
some subtlety I'm overlooking or is it a compiler bug?

Ron

struct A
{
        struct X {
        virtual A* f() {return 0;}
        };

Quote:
};

struct B : public A
{
        struct X : public A::X {
        virtual B* f() {return 0;}
        };
Quote:
};

//error C2555: 'B::X::f': overriding virtual function
return type differs and is not covariant from 'A::X::f'


Thu, 08 Dec 2005 06:00:17 GMT  
 VC7.1 covariant return bug?
Ron,

Quote:
> I'm getting an error in VC7.1 that I can't figure out.
> This didn't work in previous compiler versions but I
> thought covariant returns were working in 7.1.  Is there
> some subtlety I'm overlooking or is it a compiler bug?

> Ron

> struct A
> {
> struct X {
> virtual A* f() {return 0;}
> };
> };

> struct B : public A
> {
> struct X : public A::X {
> virtual B* f() {return 0;}
> };
> };
> //error C2555: 'B::X::f': overriding virtual function
> return type differs and is not covariant from 'A::X::f'

Seems like a bug to me. Comeau seems to agree with you, too.

--
Tomas Restrepo



Thu, 08 Dec 2005 06:25:02 GMT  
 VC7.1 covariant return bug?

Quote:

>Seems like a bug to me. Comeau seems to agree with you,
too.

Thanks Tomas.  I was afraid of that.


Thu, 08 Dec 2005 07:13:47 GMT  
 VC7.1 covariant return bug?

Quote:

>I'm getting an error in VC7.1 that I can't figure out.  
>This didn't work in previous compiler versions but I
>thought covariant returns were working in 7.1.  Is there
>some subtlety I'm overlooking or is it a compiler bug?
>//error C2555: 'B::X::f': overriding virtual function
>return type differs and is not covariant from 'A::X::f'

Ron

Are you compiling to managed code?
IIRC, the current Managed compiler does not allow for covariant return types.
I don't know if this is a limitation of the MSIL or what.

hth
sdg



Fri, 09 Dec 2005 20:41:04 GMT  
 VC7.1 covariant return bug?
Hi Ron,

Yes, that is a bug in the 7.1 VC compiler and we have it fixed for the next
product release (8.0).

--
Milis Militaru
Visual C++ Team
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
|>Content-Class: urn:content-classes:message


|>Subject: VC7.1 covariant return bug?
|>Date: Sat, 21 Jun 2003 15:00:17 -0700
|>
|>Ron
|>
|>struct A
|>{
|>   struct X {
|>   virtual A* f() {return 0;}
|>   };
|>};
|>
|>struct B : public A
|>{
|>   struct X : public A::X {
|>   virtual B* f() {return 0;}
|>   };
|>};
|>//error C2555: 'B::X::f': overriding virtual function
|>return type differs and is not covariant from 'A::X::f'
|>
|>



Wed, 14 Dec 2005 02:00:15 GMT  
 VC7.1 covariant return bug?



Quote:
> Hi Ron,

> Yes, that is a bug in the 7.1 VC compiler and we have it fixed for the
next
> product release (8.0).

Not that I'm expecting a new release soon or that I'm needing it
desperately, but when is the new release coming out? Will you be supporting
more C99 then?


Thu, 15 Dec 2005 02:42:52 GMT  
 VC7.1 covariant return bug?
We don't have any plan to increase coverage of C99. The current plan is
mainly due to very clear customer feedback. What specific parts are you
interested in?

Ronald Laeremans
Visual C++ team


Quote:



> > Hi Ron,

> > Yes, that is a bug in the 7.1 VC compiler and we have it fixed for the
> next
> > product release (8.0).

> Not that I'm expecting a new release soon or that I'm needing it
> desperately, but when is the new release coming out? Will you be
supporting
> more C99 then?



Sat, 17 Dec 2005 05:47:51 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Covariant return types support in VC7

2. BUG:C2555 On virtual functions with Covariant Return Types

3. BUG: Virtual Functions with Covariant Return Types

4. possible bug in VC6, VC7, VC7.1

5. Possible bug in vc7.0 (and vc7.1)

6. C++ .NET 2003 conformance - covariant return types

7. Covariant return types for Properties

8. Help with: C2392 - covariant returns types are not supported in managed types

9. Covariant return type

10. Covariant return type in managed class workaround?

11. Covariant return types in MC++

12. Covariant Return Types

 

 
Powered by phpBB® Forum Software