xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/2004-03-08-ReinterpretCastCopy.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o -
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple %ms_abi_triple -fno-rtti -emit-llvm %s -o -
3f4a2713aSLionel Sambuc 
4f4a2713aSLionel Sambuc struct A {
5f4a2713aSLionel Sambuc   virtual void Method() = 0;
6f4a2713aSLionel Sambuc };
7f4a2713aSLionel Sambuc 
8f4a2713aSLionel Sambuc struct B : public A {
MethodB9f4a2713aSLionel Sambuc   virtual void Method() { }
10f4a2713aSLionel Sambuc };
11f4a2713aSLionel Sambuc 
12f4a2713aSLionel Sambuc typedef void (A::*fn_type_a)(void);
13f4a2713aSLionel Sambuc typedef void (B::*fn_type_b)(void);
14f4a2713aSLionel Sambuc 
main(int argc,char ** argv)15f4a2713aSLionel Sambuc int main(int argc, char **argv)
16f4a2713aSLionel Sambuc {
17f4a2713aSLionel Sambuc   fn_type_a f = reinterpret_cast<fn_type_a>(&B::Method);
18f4a2713aSLionel Sambuc   fn_type_b g = reinterpret_cast<fn_type_b>(f);
19f4a2713aSLionel Sambuc   B b;
20f4a2713aSLionel Sambuc   (b.*g)();
21f4a2713aSLionel Sambuc   return 0;
22f4a2713aSLionel Sambuc }
23