public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33821] New: function with ambiguous covariant return-type is not rejected
@ 2007-10-19 20:42 peter dot pirkelbauer at tamu dot edu
2008-01-13 5:00 ` [Bug c++/33821] " bangerth at dealii dot org
0 siblings, 1 reply; 2+ messages in thread
From: peter dot pirkelbauer at tamu dot edu @ 2007-10-19 20:42 UTC (permalink / raw)
To: gcc-bugs
struct R1 {};
struct R2 : R1 {};
struct R3 : R1 {};
struct R4 : R2, R3 {};
struct A { virtual R1& foo(); };
struct B : virtual A { R2& foo(); };
struct C : virtual A { R3& foo(); };
struct D : B, C { R4& foo(); }; // should be rejected
R4 contains two subobjects of type R1. When D::foo is invoked in the context of
A (e.g.: in the following function bar) the cast from R4 to R1 is ambiguous.
Therefore D::foo should be rejected.
void bar(D& d)
{ A& a = d;
R1& res = a.foo();
}
--
Summary: function with ambiguous covariant return-type is not
rejected
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: peter dot pirkelbauer at tamu dot edu
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33821
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-13 2:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-19 20:42 [Bug c++/33821] New: function with ambiguous covariant return-type is not rejected peter dot pirkelbauer at tamu dot edu
2008-01-13 5:00 ` [Bug c++/33821] " bangerth at dealii 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).