[Bug c++/40997] Wrong address returned in covariant return
jwakely dot gcc at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Aug 7 13:00:00 GMT 2009
------- Comment #6 from jwakely dot gcc at gmail dot com 2009-08-07 12:59 -------
(In reply to comment #4)
> Ah, [class.virtual] paragraph 5 says:
> If the return type of D::f differs from the return type of B::f, the class type
> in the return type of D::f shall be complete at the point of declaration of
> D::f or shall be the class type D.
Here's a reduced testcase for the missing diagnostic:
struct OuterBase { };
struct B
{
virtual OuterBase* f();
};
struct OuterDerived : OuterBase
{
struct D : B {
virtual OuterDerived* f();
};
};
OuterDerived is not complete at the point of declaration of D::f and is not D.
The standard doesn't say this is undefined or "no diagnostic required" so I
think this bug should be 'accepts-invalid' rather than 'wrong-code'
--
jwakely dot gcc at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jwakely dot gcc at gmail dot
| |com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40997
More information about the Gcc-bugs
mailing list