diff options
| author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-01-28 18:33:18 +0000 |
|---|---|---|
| committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-01-28 18:33:18 +0000 |
| commit | ed8f2003185cc08916eec500df1d1c0cb88de889 (patch) | |
| tree | 10b7e1e8b5959d80a457f86b9d1be0e44c9b7541 /clang/test/SemaCXX/static-cast.cpp | |
| parent | e7d7b0c2fd6af35434678bc097eb981a9aa73a13 (diff) | |
| download | bcm5719-llvm-ed8f2003185cc08916eec500df1d1c0cb88de889.tar.gz bcm5719-llvm-ed8f2003185cc08916eec500df1d1c0cb88de889.zip | |
Implement pointer to member handling in static_cast.
Fix a stupid mistake in UnwrapSimilarPointers that made any two member pointers compatible as long as the pointee was the same.
Make a few style corrections as suggested by Chris.
llvm-svn: 63215
Diffstat (limited to 'clang/test/SemaCXX/static-cast.cpp')
| -rw-r--r-- | clang/test/SemaCXX/static-cast.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/static-cast.cpp b/clang/test/SemaCXX/static-cast.cpp index 464ea79aed9..9bbcdf670be 100644 --- a/clang/test/SemaCXX/static-cast.cpp +++ b/clang/test/SemaCXX/static-cast.cpp @@ -42,6 +42,8 @@ void t_529_2() (void)static_cast<B&>(*((C1*)0)); (void)static_cast<A*>((D*)0); (void)static_cast<const A&>(*((D*)0)); + (void)static_cast<int B::*>((int A::*)0); + (void)static_cast<void (B::*)()>((void (A::*)())0); // TODO: User-defined conversions @@ -116,4 +118,12 @@ void t_529_10() (void)static_cast<void (*)()>((void*)0); // expected-error {{static_cast from 'void *' to 'void (*)(void)' is not allowed}} } -// TODO: Test member pointers. +// Member pointer upcast. +void t_529_9() +{ + (void)static_cast<int A::*>((int B::*)0); + + // Bad code below + (void)static_cast<int A::*>((int H::*)0); // expected-error {{ambiguous conversion from pointer to member of derived class 'struct H'}} + (void)static_cast<int A::*>((int F::*)0); // expected-error {{conversion from pointer to member of class 'struct F'}} +} |

