This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13830] New: Invalid covariant type for identical type.
- From: "mattyt-bugzilla at tpg dot com dot au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Jan 2004 12:04:21 -0000
- Subject: [Bug c++/13830] New: Invalid covariant type for identical type.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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