diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-03-07 23:24:59 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-03-07 23:24:59 +0000 |
commit | 4ce46c2db2b17ef52b34dbeeec01e448025c8edc (patch) | |
tree | a81e646a24fd524ac8df5c9f8678cd835514aa1f /test/SemaCXX/static-cast.cpp | |
parent | a1a9f035852e35ed88f4902a855eb952cf08bebb (diff) |
Perform overload resolution when static_cast'ing from a
pointer-to-member-to-derived to a pointer-to-member-to-base. Fixes
PR6072.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97923 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/static-cast.cpp')
-rw-r--r-- | test/SemaCXX/static-cast.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/SemaCXX/static-cast.cpp b/test/SemaCXX/static-cast.cpp index 4818b041ad..efdc276e7d 100644 --- a/test/SemaCXX/static-cast.cpp +++ b/test/SemaCXX/static-cast.cpp @@ -181,3 +181,17 @@ struct X4 { // PR5897 - accept static_cast from const void* to const int (*)[1]. void PR5897() { (void)static_cast<const int(*)[1]>((const void*)0); } + +namespace PR6072 { + struct A { }; + struct B : A { void f(int); void f(); }; + struct C : B { }; + struct D { }; + + void f() { + (void)static_cast<void (A::*)()>(&B::f); + (void)static_cast<void (B::*)()>(&B::f); + (void)static_cast<void (C::*)()>(&B::f); + (void)static_cast<void (D::*)()>(&B::f); // expected-error{{static_cast from '<overloaded function type>' to 'void (struct PR6072::D::*)()' is not allowed}} + } +} |