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; 3+ 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] 3+ messages in thread

* [Bug c++/33821] function with ambiguous covariant return-type is not rejected
  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 ` bangerth at dealii dot org
  0 siblings, 0 replies; 3+ messages in thread
From: bangerth at dealii dot org @ 2008-01-13  5:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from bangerth at dealii dot org  2008-01-13 02:49 -------
Confirmed.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at dealii dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |accepts-invalid
   Last reconfirmed|0000-00-00 00:00:00         |2008-01-13 02:49:14
               date|                            |


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


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

* [Bug c++/33821] function with ambiguous covariant return-type is not rejected
       [not found] <bug-33821-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-01 23:34 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-01 23:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33821

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2008-01-13 02:49:14         |2021-8-1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Clang accepts this code too but both MSVC and ICC reject it.

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

end of thread, other threads:[~2021-08-01 23:34 UTC | newest]

Thread overview: 3+ 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
     [not found] <bug-33821-4@http.gcc.gnu.org/bugzilla/>
2021-08-01 23:34 ` pinskia 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).