[LLVMbugs] [Bug 17858] New: mishandling of ambiguous derived-to-base conversion in covariant return types

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Nov 8 16:40:39 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=17858

            Bug ID: 17858
           Summary: mishandling of ambiguous derived-to-base conversion in
                    covariant return types
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu,
                    rjmccall at apple.com
    Classification: Unclassified

Consider:

struct A {};
struct B : A {};
struct C : A {};
struct D : B, C {} d;

struct X { virtual A *f() = 0; };
struct Y : X { virtual C *f() = 0; };
struct Z : Y { virtual D *f() { return &d; } } z;

This seems to be ill-formed, per 10.3/2 and 10.3/7: Z::f overrides both X::f
and Y::f, but D* does not have an unambiguous conversion to A*.

(Even if we thought it was valid, we produce wrong code: X::f() returns d's
B::A subobject, not its C::A subobject.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131109/6ea99c27/attachment.html>


More information about the llvm-bugs mailing list