[llvm-bugs] [Bug 28591] New: Can't implicitly cast from class with multiple inheritance to a base of a virtually base class if public inheritance follows after private or protected, but not before them
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Jul 17 12:36:42 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=28591
Bug ID: 28591
Summary: Can't implicitly cast from class with multiple
inheritance to a base of a virtually base class if
public inheritance follows after private or protected,
but not before them
Product: clang
Version: 3.1
Hardware: PC
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: maxim.mishchenko at gmail.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Classification: Unclassified
# version: clang-703.0.31,
# sample.cpp
class foo {};
class foofoo: public foo {};
class private_bar: private virtual foofoo {};
class public_bar: public virtual foofoo {};
class foobar_public_first: public public_bar, public private_bar {};
class foobar_private_first: public private_bar, public public_bar {};
void test_foobar() {
foo *foo1 = new foobar_public_first(); // OK
foo *foo2 = new foobar_private_first(); // compile error - "Cannot cast
'foobar_private_first' to its private base class 'foo'"
}
So, availability of casting to base depends on how ancestor classes are ordered
in the inheritance list.
--
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/20160717/276e550a/attachment.html>
More information about the llvm-bugs
mailing list