diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2010-07-23 19:25:41 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2010-07-23 19:25:41 +0000 |
commit | 0fab8cd9bd9093ce16b6ce64a152d861ba408652 (patch) | |
tree | 64420d3982481fd50f759842f913558f12fe81bd /test/SemaCXX/access-member-pointer.cpp | |
parent | 320198303df7c16950d83ae79c3f702b84badcf7 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109257 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/access-member-pointer.cpp')
-rw-r--r-- | test/SemaCXX/access-member-pointer.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/SemaCXX/access-member-pointer.cpp b/test/SemaCXX/access-member-pointer.cpp new file mode 100644 index 0000000000..676eb10dcd --- /dev/null +++ b/test/SemaCXX/access-member-pointer.cpp @@ -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'}} +} |