public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13830] New: Invalid covariant type for identical type.
@ 2004-01-23 12:04 mattyt-bugzilla at tpg dot com dot au
  2004-01-23 16:26 ` [Bug c++/13830] " bangerth at dealii dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: mattyt-bugzilla at tpg dot com dot au @ 2004-01-23 12:04 UTC (permalink / raw)
  To: gcc-bugs

The code below:

template < class TP >
class A {
public:
   
  friend class X;
   
  typedef X * XP;
   
  class X {};
   
  virtual XP method();
   
};
 
template < class TP >
class B : public A< TP > {
public:
   
  virtual typename A< TP >::XP method();
   
};
 
int main() {
  B<int> a;
}

gives the error in 3.4:

restor5.cc: In instantiation of `B<int>':
restor5.cc:24:   instantiated from here
restor5.cc:19: error: invalid covariant return type for `typename A<TP>::XP
B<TP>::method() [with TP = int]'
restor5.cc:11: error:   overriding `X* A<TP>::method() [with TP = int]'

as best as I can tell, the type is identical and so it should compile.

-- 
           Summary: Invalid covariant type for identical type.
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mattyt-bugzilla at tpg dot com dot au
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2005-05-22 14:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-23 12:04 [Bug c++/13830] New: Invalid covariant type for identical type mattyt-bugzilla at tpg dot com dot au
2004-01-23 16:26 ` [Bug c++/13830] " bangerth at dealii dot org
2004-04-23 21:07 ` [Bug c++/13830] Invalid covariant type for identical type, friend related pinskia at gcc dot gnu dot org
2004-04-24  8:26 ` bangerth at dealii dot org
2004-10-13 15:17 ` lerdsuwa at gcc dot gnu dot org
2004-12-28 15:29 ` lerdsuwa at gcc dot gnu dot org
2005-03-14 14:40 ` lerdsuwa at gcc dot gnu dot org
2005-05-22 11:43 ` lerdsuwa at gcc dot gnu dot org
2005-05-22 14:06 ` pinskia at gcc dot gnu dot 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).