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 | c934bc840cb483a56da06bd9dbeff8bab32af84d (patch) | |
| tree | f604c180949233d6f503fedc5c4bc88d98cad2aa /clang/test/SemaCXX/static-cast.cpp | |
| parent | 1ce52caf0dfd18b8a2e04eddd9e381136ac81c21 (diff) | |
| download | bcm5719-llvm-c934bc840cb483a56da06bd9dbeff8bab32af84d.tar.gz bcm5719-llvm-c934bc840cb483a56da06bd9dbeff8bab32af84d.zip | |
Perform overload resolution when static_cast'ing from a
pointer-to-member-to-derived to a pointer-to-member-to-base. Fixes
PR6072.
llvm-svn: 97923
Diffstat (limited to 'clang/test/SemaCXX/static-cast.cpp')
| -rw-r--r-- | clang/test/SemaCXX/static-cast.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/static-cast.cpp b/clang/test/SemaCXX/static-cast.cpp index 4818b041ad0..efdc276e7d0 100644 --- a/clang/test/SemaCXX/static-cast.cpp +++ b/clang/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}} + } +} |

