https://bugs.llvm.org/show_bug.cgi?id=35462
Bug ID: 35462
Summary: dynamic_cast to virtual base with multiple access
control
Product: clang
Version: 5.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++11
Assignee: unassignedclangb...@nondot.org
Reporter: stephane.zimmerm...@trust-in-soft.com
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
The following code:
struct Foo {
int x = 42;
virtual void f() {}
};
struct PublicBar: public virtual Foo { };
struct PrivateBar: private virtual Foo { };
struct EntryPoint {
virtual void g() {}
};
struct Baz: PublicBar, PrivateBar, EntryPoint {};
int main(void) {
Baz b;
EntryPoint *e = &b;
Foo *f = dynamic_cast<Foo *>(e);
return f->x;
}
when compiled and executed causes a segmentation fault because the dynamic_cast
is failing.
The dynamic cast should not fail, as the Foo base is unique because it is
virtual and is accessible because of the path PublicBar::Foo.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs