[LLVMbugs] [Bug 19795] New: dynamic_cast prohibited due to wrongly detecting ambiguity

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon May 19 13:45:02 PDT 2014


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

            Bug ID: 19795
           Summary: dynamic_cast prohibited due to wrongly detecting
                    ambiguity
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david.majnemer at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

consider:
struct X { virtual void fun(); };
struct V : public X {};
struct W : private virtual V {};
struct Y : private W, public virtual V {};

void f(Y *x) {
  (void)dynamic_cast<X*>(x);
}

we diagnose with:
<stdin>:7:9: error: cannot cast 'Y' to its private base class 'X'
  (void)dynamic_cast<X*>(x);
        ^
<stdin>:3:12: note: constrained by private inheritance here
struct W : private virtual V {};
           ^~~~~~~~~~~~~~~~~


However, Y publicly inherits from virtual V.  GCC, ICC and MSVC all believe
that this is legit.

-- 
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/20140519/87421a4f/attachment.html>


More information about the llvm-bugs mailing list