forked from OSchip/llvm-project
Fix for PR7694: make sure to pass in a RecordType to CheckBaseClassAccess;
fixes crashes on both valid and invalid code. The diagnostic here could potentially be improved, but it's good enough as-is. llvm-svn: 109257
This commit is contained in:
parent
c51609a0b5
commit
d4c75cddde
|
@ -900,7 +900,7 @@ TryStaticMemberPointerUpcast(Sema &Self, Expr *&SrcExpr, QualType SrcType,
|
|||
}
|
||||
|
||||
if (!CStyle && Self.CheckBaseClassAccess(OpRange.getBegin(),
|
||||
DestType, SrcType,
|
||||
DestClass, SrcClass,
|
||||
Paths.front(),
|
||||
diag::err_upcast_to_inaccessible_base)) {
|
||||
msg = 0;
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// 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'}}
|
||||
}
|
Loading…
Reference in New Issue