public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/46220] New: Error: invalid covariant return type generated for incomplete class type
@ 2010-10-28 23:10 nathan.keynes at oracle dot com
  2010-10-28 23:16 ` [Bug c++/46220] [4.3/4.4/4.5/4.6 Regression] Error: invalid covariant return type generated for incomplete class type and different qualifer pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: nathan.keynes at oracle dot com @ 2010-10-28 23:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46220

           Summary: Error: invalid covariant return type generated for
                    incomplete class type
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: nathan.keynes@oracle.com


g++ fails to compile the following test case:

class Baz;
class Foo {
public:
    virtual const Baz* getBaz() = 0;
};
class Bar : public Foo {
public:
    Baz* getBaz();
};

test-covar.cc:8: error: invalid covariant return type for ‘virtual Baz*
Bar::getBaz()’
test-covar.cc:4: error:   overriding ‘virtual const Baz* Foo::getBaz()’

However, it compiles successfully if Baz is complete:
class Baz { };
class Foo {
public:
    virtual const Baz* getBaz() = 0;
};
class Bar : public Foo {
public:
    Baz* getBaz();
};

Reproducible on x86_64-redhat-linux (4.1.2 and 4.4.0) and
i386-pc-solaris2.11 (4.2.4, 4.3.4 and 4.5.1). Works correctly with g++ 3.4.3


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-03-05 20:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-28 23:10 [Bug c++/46220] New: Error: invalid covariant return type generated for incomplete class type nathan.keynes at oracle dot com
2010-10-28 23:16 ` [Bug c++/46220] [4.3/4.4/4.5/4.6 Regression] Error: invalid covariant return type generated for incomplete class type and different qualifer pinskia at gcc dot gnu.org
2010-10-29  0:45 ` redi at gcc dot gnu.org
2010-10-29  0:51 ` redi at gcc dot gnu.org
2010-10-29  1:16 ` redi at gcc dot gnu.org
2010-11-12 14:51 ` rguenth at gcc dot gnu.org
2011-03-03 20:52 ` jason at gcc dot gnu.org
2011-03-04 15:18 ` jason at gcc dot gnu.org
2011-03-05 20:35 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).