fixes crashes on both valid and invalid code. The diagnostic here could
potentially be improved, but it's good enough as-is.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109257
91177308-0d34-0410-b5e6-
96231b3b80d8
}
if (!CStyle && Self.CheckBaseClassAccess(OpRange.getBegin(),
- DestType, SrcType,
+ DestClass, SrcClass,
Paths.front(),
diag::err_upcast_to_inaccessible_base)) {
msg = 0;
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// PR7694
+
+class A { };
+class B : private A { public: void foo(); }; // expected-note {{declared private here}}
+void B::foo() {
+ (void)static_cast<void(A::*)()>(&B::foo);
+}
+void bar() {
+ (void)static_cast<void(A::*)()>(&B::foo); // expected-error {{cannot cast 'B' to its private base class 'A'}}
+}